built-in rebase: demonstrate regression with --autostash
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 7 Nov 2018 14:00:48 +0000 (06:00 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Nov 2018 01:16:35 +0000 (10:16 +0900)
An unnamed colleague of Ævar Arnfjörð Bjarmason reported a breakage
where a `pull --rebase` (which did not really need to do anything but
stash, see that nothing was changed, and apply the stash again) also
detached the HEAD.

This patch adds a minimal reproducer for this regression.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t3420-rebase-autostash.sh
index 001d6243c9afd5368f6c4e38a7cb221df6810995..cc6149d53f220f46a9311275b4fc096b41f7a74d 100755 (executable)
@@ -361,4 +361,12 @@ test_expect_success 'autostash with dirty submodules' '
        git rebase -i --autostash HEAD
 '
 
+test_expect_failure 'branch is left alone when possible' '
+       git checkout -b unchanged-branch &&
+       echo changed >file0 &&
+       git rebase --autostash unchanged-branch &&
+       test changed = "$(cat file0)" &&
+       test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)"
+'
+
 test_done