summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-22 21:15:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-22 21:15:25 (GMT)
commit1565b18791b4b27ab464764d37b86a673165ab07 (patch)
tree96f42f3af22659c187c9a473d538aaa5ad737c1a
parent49a8bf2edaa7c5922677e1ae04cf44df0c0c8abf (diff)
parentbb8efa1772c5a2ae1ce13ee2482fc8d97011ab7a (diff)
downloadgit-1565b18791b4b27ab464764d37b86a673165ab07.zip
git-1565b18791b4b27ab464764d37b86a673165ab07.tar.gz
git-1565b18791b4b27ab464764d37b86a673165ab07.tar.bz2
Merge branch 'sd/t3200-branch-m-test'
New test. * sd/t3200-branch-m-test: t3200: add test for single parameter passed to -m option
-rwxr-xr-xt/t3200-branch.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 10f8f02..48d152b 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -100,6 +100,23 @@ test_expect_success 'git branch -m n/n n should work' '
git reflog exists refs/heads/n
'
+# The topmost entry in reflog for branch bbb is about branch creation.
+# Hence, we compare bbb@{1} (instead of bbb@{0}) with aaa@{0}.
+
+test_expect_success 'git branch -m bbb should rename checked out branch' '
+ test_when_finished git branch -D bbb &&
+ test_when_finished git checkout master &&
+ git checkout -b aaa &&
+ git commit --allow-empty -m "a new commit" &&
+ git rev-parse aaa@{0} >expect &&
+ git branch -m bbb &&
+ git rev-parse bbb@{1} >actual &&
+ test_cmp expect actual &&
+ git symbolic-ref HEAD >actual &&
+ echo refs/heads/bbb >expect &&
+ test_cmp expect actual
+'
+
test_expect_success 'git branch -m o/o o should fail when o/p exists' '
git branch o/o &&
git branch o/p &&