@matheusbsbs / matheus-bagliano / commits / c8769f76d9
Fork 0

git-sh-setup: do not use repo-config to test the git directory

Since repo-config does not fail in non-git directory, it is not a good command to use to test the git-ness nor validate the repository revision of $GIT_DIR. Original patch by Robert Shearman but with minor fixes. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Aug 11, 2006 at 18:47 UTC c8769f76d992ed391d169cd71be009ca17727271
1 file changed +3 -8
git-sh-setup.sh
+3 -8
@@ -35,17 +35,12 @@ case "$1" in
35 exit
36 esac
37
38 +# Make sure we are in a valid repository of a vintage we understand.
39 if [ -z "$SUBDIRECTORY_OK" ]
40 then
41 : ${GIT_DIR=.git}
41 - : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
42 -
43 - # Make sure we are in a valid repository of a vintage we understand.
44 - GIT_DIR="$GIT_DIR" git repo-config --get core.nosuch >/dev/null
45 - if test $? = 128
46 - then
47 - exit
48 - fi
42 + GIT_DIR=$(GIT_DIR="$GIT_DIR" git-rev-parse --git-dir) || exit
43 else
44 GIT_DIR=$(git-rev-parse --git-dir) || exit
45 fi
46 +: ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}