Skip to content

Commit

Permalink
git-sh-setup: move GIT_DIR initialization into a function
Browse files Browse the repository at this point in the history
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
David Aguilar authored and Junio C Hamano committed Oct 15, 2014
1 parent 9c66cd3 commit 1c7e2d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions git-sh-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 () {
Expand Down

0 comments on commit 1c7e2d2

Please sign in to comment.