aboutsummaryrefslogtreecommitdiff
path: root/git-branch.sh
diff options
context:
space:
mode:
authorChristian Couder <chriscool@tuxfamily.org>2006-09-28 07:00:38 +0200
committerJunio C Hamano <junkio@cox.net>2006-09-27 22:26:31 -0700
commit5be7649131379e49f27d89cb6dd5bd8d0912a3d6 (patch)
tree55eb3555784323bba227ade1a14b9b4647138950 /git-branch.sh
parent919a3c981323b6f919747bf6756aa8f5af09361f (diff)
downloadgit-5be7649131379e49f27d89cb6dd5bd8d0912a3d6.tar.gz
git-5be7649131379e49f27d89cb6dd5bd8d0912a3d6.tar.xz
When creating branch c/d check that branch c does not already exists.
With packed refs, there may not be a ".git/refs/heads/c" file when branch c exists. And currently in this case, there is no check to prevent creation of branch c/d. This should probably be rewritten in C and done after the ref lock has been taken to make sure no race exists though. This is mainly to make all test cases in "t3210-pack-refs.sh" work. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-branch.sh')
-rwxr-xr-xgit-branch.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/git-branch.sh b/git-branch.sh
index bf84b3069..c61683033 100755
--- a/git-branch.sh
+++ b/git-branch.sh
@@ -121,6 +121,16 @@ then
done
fi
+branchdir=$(dirname $branchname)
+while test "$branchdir" != "."
+do
+ if git-show-ref --verify --quiet -- "refs/heads/$branchdir"
+ then
+ die "$branchdir already exists."
+ fi
+ branchdir=$(dirname $branchdir)
+done
+
prev=''
if git-show-ref --verify --quiet -- "refs/heads/$branchname"
then