]> granicus.if.org Git - git/commitdiff
git-sh-setup: move GIT_DIR initialization into a function
authorDavid Aguilar <davvid@gmail.com>
Sat, 11 Oct 2014 08:39:36 +0000 (01:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 15 Oct 2014 21:12:20 +0000 (14:12 -0700)
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-sh-setup.sh

index 5f28b32dc7ff75830bde919b2f4776f7a9b017e2..3eb1b678386f7e9ed569dd8b11d78c4c508bbadc 100644 (file)
@@ -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 () {