summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e7bfe2)
raw | patch | inline | side by side (parent: 5e7bfe2)
author | Junio C Hamano <junkio@cox.net> | |
Fri, 25 Nov 2005 23:52:57 +0000 (15:52 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Fri, 25 Nov 2005 23:55:50 +0000 (15:55 -0800) |
Any core commands that use setup_git_directory() now check if
given GIT_DIR is really a valid repository, so the same check in
git-sh-setup can use it without reimplementing it in shell.
This commit changes git-sh-setup to use git-var command for
that, although any other commands would do.
Note that we export GIT_DIR explicitly when calling git-var;
without it, the caller of this script would use GIT_DIR that we
return (which is to assume ./.git unless the caller has it
elsewhere) while git-var would go up to find a .git directory in
our parent directories, which would be checking a different
directory from what our callers will be using.
Signed-off-by: Junio C Hamano <junkio@cox.net>
given GIT_DIR is really a valid repository, so the same check in
git-sh-setup can use it without reimplementing it in shell.
This commit changes git-sh-setup to use git-var command for
that, although any other commands would do.
Note that we export GIT_DIR explicitly when calling git-var;
without it, the caller of this script would use GIT_DIR that we
return (which is to assume ./.git unless the caller has it
elsewhere) while git-var would go up to find a .git directory in
our parent directories, which would be checking a different
directory from what our callers will be using.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-sh-setup.sh | patch | blob | history |
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index e343349c0087aefbb42d17ace9102a72d2fb437a..b4f10224baf8328a9d6efa761b025450df414bb2 100755 (executable)
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
exit 1
}
-case "$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD 2>/dev/null)" in
-refs/*) : ;;
-*) false ;;
-esac &&
-[ -d "$GIT_DIR/refs" ] &&
-[ -d "$GIT_OBJECT_DIRECTORY/" ] ||
- die "Not a git repository."
+# Make sure we are in a valid repository of a vintage we understand.
+GIT_DIR="$GIT_DIR" git-var GIT_AUTHOR_IDENT >/dev/null || exit