Skip to content

Commit fd6e124

Browse files
masahir0ymichal42
authored andcommitted
scripts: objdiff: get the path to .tmp_objdiff more simply
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 <yamada.m@jp.panasonic.com> Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent a1323fd commit fd6e124

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

scripts/objdiff

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@
2525
#
2626
# Note: 'make mrproper' will also remove .tmp_objdiff
2727

28-
GIT_DIR="`git rev-parse --git-dir`"
28+
SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null)
2929

30-
if [ -d "$GIT_DIR" ]; then
31-
TMPD="${GIT_DIR%git}tmp_objdiff"
32-
33-
[ -d "$TMPD" ] || mkdir "$TMPD"
34-
else
35-
echo "ERROR: git directory not found."
30+
if [ -z "$SRCTREE" ]; then
31+
echo "ERROR: Not a git repository."
3632
exit 1
3733
fi
3834

35+
TMPD=$SRCTREE/.tmp_objdiff
36+
3937
usage() {
4038
echo "Usage: $0 <command> <args>"
4139
echo " record <list of object files>"

0 commit comments

Comments
 (0)