Skip to content

Commit 1c7e2d2

Browse files
davvidgitster
authored andcommitted
git-sh-setup: move GIT_DIR initialization into a function
Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9c66cd3 commit 1c7e2d2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

git-sh-setup.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,7 @@ esac
330330
331331
# Make sure we are in a valid repository of a vintage we understand,
332332
# if we require to be in a git repository.
333-
if test -z "$NONGIT_OK"
334-
then
333+
git_dir_init () {
335334
GIT_DIR=$(git rev-parse --git-dir) || exit
336335
if [ -z "$SUBDIRECTORY_OK" ]
337336
then
@@ -346,6 +345,11 @@ then
346345
exit 1
347346
}
348347
: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
348+
}
349+
350+
if test -z "$NONGIT_OK"
351+
then
352+
git_dir_init
349353
fi
350354
351355
peel_committish () {

0 commit comments

Comments
 (0)