aboutsummaryrefslogtreecommitdiff
path: root/git-checkout.sh
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@osdl.org>2006-09-15 14:56:55 -0700
committerJunio C Hamano <junkio@cox.net>2006-09-16 02:23:51 -0700
commit305e22c36e674924de6decb29e8a4c22292b5054 (patch)
tree6d5b0ae8f5b66d8ca4baa3b517ab5dd8957a376c /git-checkout.sh
parent358ddb62cfd03bba1ca2f1ae8e81b9510f42ea9a (diff)
downloadgit-305e22c36e674924de6decb29e8a4c22292b5054.tar.gz
git-305e22c36e674924de6decb29e8a4c22292b5054.tar.xz
Teach "git checkout" to use git-show-ref
That way, it doesn't care how the refs are stored any more Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-checkout.sh')
-rwxr-xr-xgit-checkout.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/git-checkout.sh b/git-checkout.sh
index 580a9e8a2..f03620b05 100755
--- a/git-checkout.sh
+++ b/git-checkout.sh
@@ -22,7 +22,7 @@ while [ "$#" != "0" ]; do
shift
[ -z "$newbranch" ] &&
die "git checkout: -b needs a branch name"
- [ -e "$GIT_DIR/refs/heads/$newbranch" ] &&
+ git-show-ref --verify --quiet -- "refs/heads/$newbranch" &&
die "git checkout: branch $newbranch already exists"
git-check-ref-format "heads/$newbranch" ||
die "git checkout: we do not like '$newbranch' as a branch name."
@@ -51,7 +51,8 @@ while [ "$#" != "0" ]; do
fi
new="$rev"
new_name="$arg^0"
- if [ -f "$GIT_DIR/refs/heads/$arg" ]; then
+ if git-show-ref --verify --quiet -- "refs/heads/$arg"
+ then
branch="$arg"
fi
elif rev=$(git-rev-parse --verify "$arg^{tree}" 2>/dev/null)