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>
This commit is contained in:
Masahiro Yamada 2014-06-09 11:16:34 +09:00 committed by Michal Marek
parent a1323fd163
commit fd6e124233
1 changed files with 5 additions and 7 deletions

View File

@ -25,17 +25,15 @@
# #
# Note: 'make mrproper' will also remove .tmp_objdiff # 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 if [ -z "$SRCTREE" ]; then
TMPD="${GIT_DIR%git}tmp_objdiff" echo "ERROR: Not a git repository."
[ -d "$TMPD" ] || mkdir "$TMPD"
else
echo "ERROR: git directory not found."
exit 1 exit 1
fi fi
TMPD=$SRCTREE/.tmp_objdiff
usage() { usage() {
echo "Usage: $0 <command> <args>" echo "Usage: $0 <command> <args>"
echo " record <list of object files>" echo " record <list of object files>"