summaryrefslogtreecommitdiff
path: root/t/t2012-checkout-last.sh
diff options
context:
space:
mode:
authorRamkumar Ramachandra <artagnon@gmail.com>2013-06-16 14:15:11 +0530
committerJunio C Hamano <gitster@pobox.com>2013-06-17 09:56:57 -0700
commit89f2fea49a246e9ac4fa94cb43a7e992a8a4a144 (patch)
tree2b01185fd9a1c7618bde58504fd1319b922afc16 /t/t2012-checkout-last.sh
parentce23d493b479d754321c9d835039a93e7fde9671 (diff)
downloadgit-89f2fea49a246e9ac4fa94cb43a7e992a8a4a144.tar.gz
t/t2021-checkout-last: "checkout -" should work after a rebase finishes
$ git checkout - does not work as expected after a rebase. This is because the reflog records "checkout" made by "rebase" as its implementation detail the same way as end-user initiated "checkout", and makes it count as the branch that was previously checked out. Add four failing tests documenting this bug: two for a normal rebase, and another two for an interactive rebase. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2012-checkout-last.sh')
-rwxr-xr-xt/t2012-checkout-last.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/t/t2012-checkout-last.sh b/t/t2012-checkout-last.sh
index b44de9dc62..6ad6edf0f9 100755
--- a/t/t2012-checkout-last.sh
+++ b/t/t2012-checkout-last.sh
@@ -116,4 +116,38 @@ test_expect_success 'master...' '
test "z$(git rev-parse --verify HEAD)" = "z$(git rev-parse --verify master^)"
'
+test_expect_failure '"checkout -" works after a rebase A' '
+ git checkout master &&
+ git checkout other &&
+ git rebase master &&
+ git checkout - &&
+ test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
+'
+
+test_expect_failure '"checkout -" works after a rebase A B' '
+ git branch moodle master~1 &&
+ git checkout master &&
+ git checkout other &&
+ git rebase master moodle &&
+ git checkout - &&
+ test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
+'
+
+test_expect_failure '"checkout -" works after a rebase -i A' '
+ git checkout master &&
+ git checkout other &&
+ git rebase -i master &&
+ git checkout - &&
+ test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
+'
+
+test_expect_failure '"checkout -" works after a rebase -i A B' '
+ git branch foodle master~1 &&
+ git checkout master &&
+ git checkout other &&
+ git rebase master foodle &&
+ git checkout - &&
+ test "z$(git symbolic-ref HEAD)" = "zrefs/heads/master"
+'
+
test_done