summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
authorJunio C Hamano <junio@twinsun.com>2005-09-30 21:26:57 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-10-02 06:19:33 (GMT)
commit8098a178b26dc7a158d129a092a5b78da6d12b72 (patch)
treea91aec067dd33319e2f33de565c42ef43b449b56 /git-sh-setup.sh
parenta876ed83be5467d6075da8a16306724cb1babc2a (diff)
downloadgit-8098a178b26dc7a158d129a092a5b78da6d12b72.zip
git-8098a178b26dc7a158d129a092a5b78da6d12b72.tar.gz
git-8098a178b26dc7a158d129a092a5b78da6d12b72.tar.bz2
Add git-symbolic-ref
This adds the counterpart of git-update-ref that lets you read and create "symbolic refs". By default it uses a symbolic link to represent ".git/HEAD -> refs/heads/master", but it can be compiled to use the textfile symbolic ref. The places that did 'readlink .git/HEAD' and 'ln -s refs/heads/blah .git/HEAD' have been converted to use new git-symbolic-ref command, so that they can deal with either implementation. Signed-off-by: Junio C Hamano <junio@twinsun.com>
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-xgit-sh-setup.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 55db795..a017268 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -13,10 +13,13 @@
unset CDPATH
die() {
- echo "$@" >&2
+ echo >&2 "$@"
exit 1
}
-[ -h "$GIT_DIR/HEAD" ] &&
+case "$(GIT_DIR="$GIT_DIR" git-symbolic-ref HEAD 2>/dev/null)" in
+refs/*) : ;;
+*) false ;;
+esac &&
[ -d "$GIT_DIR/refs" ] &&
[ -d "$GIT_OBJECT_DIRECTORY/00" ]