diff options
author | Lars Hjemli <hjemli@gmail.com> | 2008-02-18 11:44:19 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-18 21:53:44 -0800 |
commit | 4d6d6d2d3f778b892f2481969e530ff67ee0aa6c (patch) | |
tree | 2b433f37d05c335ac5473850f6ca11cb77bdce3b /git-sh-setup.sh | |
parent | ee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e (diff) | |
download | git-4d6d6d2d3f778b892f2481969e530ff67ee0aa6c.tar.gz |
Simplify setup of $GIT_DIR in git-sh-setup.sh
Using 'git rev-parse --git-dir' makes the code shorter and more future-
proof.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-x | git-sh-setup.sh | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index f38827529f..a44b1c74a3 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -127,20 +127,14 @@ get_author_ident_from_commit () { # if we require to be in a git repository. if test -z "$NONGIT_OK" then + GIT_DIR=$(git rev-parse --git-dir) || exit if [ -z "$SUBDIRECTORY_OK" ] then - : ${GIT_DIR=.git} test -z "$(git rev-parse --show-cdup)" || { exit=$? echo >&2 "You need to run this command from the toplevel of the working tree." exit $exit } - else - GIT_DIR=$(git rev-parse --git-dir) || { - exit=$? - echo >&2 "Failed to find a valid git directory." - exit $exit - } fi test -n "$GIT_DIR" && GIT_DIR=$(cd "$GIT_DIR" && pwd) || { echo >&2 "Unable to determine absolute path of git directory" |