From: David Aguilar Date: Sat, 11 Oct 2014 08:39:36 +0000 (-0700) Subject: git-sh-setup: move GIT_DIR initialization into a function X-Git-Tag: v2.2.0-rc0~29^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c7e2d23e4f22f1599570d9c5d0cc2f4156b5b74;p=git git-sh-setup: move GIT_DIR initialization into a function Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 5f28b32dc7..3eb1b67838 100644 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -330,8 +330,7 @@ esac # Make sure we are in a valid repository of a vintage we understand, # if we require to be in a git repository. -if test -z "$NONGIT_OK" -then +git_dir_init () { GIT_DIR=$(git rev-parse --git-dir) || exit if [ -z "$SUBDIRECTORY_OK" ] then @@ -346,6 +345,11 @@ then exit 1 } : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"} +} + +if test -z "$NONGIT_OK" +then + git_dir_init fi peel_committish () {