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>
Christian Couder committed
Sep 28, 2006 at 07:00 UTC
5be7649131379e49f27d89cb6dd5bd8d0912a3d6
1 file changed
+10
git-branch.sh
+10
@@ -121,6 +121,16 @@ then
121
done
122
fi
123
124
+branchdir=$(dirname $branchname)
125
+while test "$branchdir" != "."
126
+do
127
+ if git-show-ref --verify --quiet -- "refs/heads/$branchdir"
128
+ then
129
+ die "$branchdir already exists."
130
+ fi
131
+ branchdir=$(dirname $branchdir)
132
+done
133
+
134
prev=''
135
if git-show-ref --verify --quiet -- "refs/heads/$branchname"
136
then