]> Git Repo - linux.git/commitdiff
scripts: objdiff: get the path to .tmp_objdiff more simply
authorMasahiro Yamada <[email protected]>
Mon, 9 Jun 2014 02:16:34 +0000 (11:16 +0900)
committerMichal Marek <[email protected]>
Tue, 10 Jun 2014 12:59:33 +0000 (14:59 +0200)
This commit is a minor refactoring.

Temporary files for objdiff are stored in .tmp_objdiff directory
which is located at the top directory.

To get the path to this directory,

  SRCTREE=`git rev-parse --show-toplevel`
  TMPD=$SRCTREE/.tmp_objdiff

seems easier to understand than

  GIT_DIR=`git rev-parse --git-dir`
  TMPD=${GIT_DIR%git}tmp_objdiff

Besides, it is not always necessary to create .tmp_objdiff dicrectory.
It should be created only for "record" command.

Signed-off-by: Masahiro Yamada <[email protected]>
Acked-by: Jason Cooper <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
scripts/objdiff

index b3e4f10bfc3edac5a5119d31f432371f8e75feee..b8f7fc60563e9dac1092644c8cbafd7bc998c3e9 100755 (executable)
 #
 # Note: 'make mrproper' will also remove .tmp_objdiff
 
-GIT_DIR="`git rev-parse --git-dir`"
+SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null)
 
-if [ -d "$GIT_DIR" ]; then
-       TMPD="${GIT_DIR%git}tmp_objdiff"
-
-       [ -d "$TMPD" ] || mkdir "$TMPD"
-else
-       echo "ERROR: git directory not found."
+if [ -z "$SRCTREE" ]; then
+       echo "ERROR: Not a git repository."
        exit 1
 fi
 
+TMPD=$SRCTREE/.tmp_objdiff
+
 usage() {
        echo "Usage: $0 <command> <args>"
        echo "  record    <list of object files>"
This page took 0.054942 seconds and 4 git commands to generate.