summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4dafd7d)
raw | patch | inline | side by side (parent: 4dafd7d)
author | Christian Couder <chriscool@tuxfamily.org> | |
Tue, 26 Sep 2006 05:23:37 +0000 (07:23 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 26 Sep 2006 06:54:40 +0000 (23:54 -0700) |
This patch also adds test cases from Linus and Junio.
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
git-branch.sh | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
diff --git a/git-branch.sh b/git-branch.sh
index e0501ec23f5c40134af0e6211cf1ba28e69e1d5b..4f31903d63662db7d49d3d257e328004ca2958f7 100755 (executable)
--- a/git-branch.sh
+++ b/git-branch.sh
git-check-ref-format "heads/$branchname" ||
die "we do not like '$branchname' as a branch name."
+if [ -d "$GIT_DIR/refs/heads/$branchname" ]
+then
+ for refdir in `cd "$GIT_DIR" && \
+ find "refs/heads/$branchname" -type d | sort -r`
+ do
+ rmdir "$GIT_DIR/$refdir" || \
+ die "Could not delete '$refdir', there may still be a ref there."
+ done
+fi
+
if [ -e "$GIT_DIR/refs/heads/$branchname" ]
then
if test '' = "$force"
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 5b04efc89d54c79df49495bb8fa44931729df682..6907cbcd295614bf895ef2a8d0be59e08e570f09 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
test -f .git/logs/refs/heads/g/h/i &&
diff expect .git/logs/refs/heads/g/h/i'
+test_expect_success \
+ 'git branch j/k should work after branch j has been deleted' \
+ 'git-branch j &&
+ git-branch -d j &&
+ git-branch j/k'
+
+test_expect_success \
+ 'git branch l should work after branch l/m has been deleted' \
+ 'git-branch l/m &&
+ git-branch -d l/m &&
+ git-branch l'
+
test_done