summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-11-25 23:52:57 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-11-25 23:55:50 (GMT)
commit2a1ddc58e4d2220feea7eba4623dac07a0f83f94 (patch)
tree31b3c7eeb719c61a19922f3e8bf5abd46b49b5bb
parent5e7bfe256755ef2862e960864db1edb829c82b77 (diff)
downloadgit-2a1ddc58e4d2220feea7eba4623dac07a0f83f94.zip
git-2a1ddc58e4d2220feea7eba4623dac07a0f83f94.tar.gz
git-2a1ddc58e4d2220feea7eba4623dac07a0f83f94.tar.bz2
git-sh-setup: move the repository check to a core program.
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>
-rwxr-xr-xgit-sh-setup.sh9
1 files changed, 2 insertions, 7 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index e343349..b4f1022 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -19,10 +19,5 @@ die() {
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