aboutsummaryrefslogtreecommitdiff
path: root/t/t3200-branch.sh
diff options
context:
space:
mode:
authorRené Scharfe <rene.scharfe@lsrfire.ath.cx>2012-10-18 14:05:17 +0200
committerJunio C Hamano <gitster@pobox.com>2012-10-18 14:36:16 -0700
commit566c7707db4eb18a116659b08d6ff7ad79fcfefd (patch)
tree1be45a8788e1c07c3f8843364e17c33b92a964ba /t/t3200-branch.sh
parent22ed79275360a3dbb480e2c510a94c4b817afad2 (diff)
downloadgit-566c7707db4eb18a116659b08d6ff7ad79fcfefd.tar.gz
git-566c7707db4eb18a116659b08d6ff7ad79fcfefd.tar.xz
branch: delete symref branch, not its target
If a branch that is to be deleted happens to be a symref to another branch, the current code removes the targeted branch instead of the one it was called for. Change this surprising behaviour and delete the symref branch instead. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3200-branch.sh')
-rwxr-xr-xt/t3200-branch.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 79c8d0142..ec5f70eeb 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -262,6 +262,17 @@ test_expect_success 'config information was renamed, too' \
"test $(git config branch.s.dummy) = Hello &&
test_must_fail git config branch.s/s/dummy"
+test_expect_success 'deleting a symref' '
+ git branch target &&
+ git symbolic-ref refs/heads/symref refs/heads/target &&
+ sha1=$(git rev-parse symref | cut -c 1-7) &&
+ echo "Deleted branch symref (was $sha1)." >expect &&
+ git branch -d symref >actual &&
+ test_path_is_file .git/refs/heads/target &&
+ test_path_is_missing .git/refs/heads/symref &&
+ test_i18ncmp expect actual
+'
+
test_expect_success 'renaming a symref is not allowed' \
'
git symbolic-ref refs/heads/master2 refs/heads/master &&