built-in rebase: demonstrate regression with --autostash

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>

Johannes Schindelin committed Nov 7, 2018 at 06:00 UTC 2dac2bc843198c378b1f14dc9b7d3994cb240c97
1 file changed +8
t/t3420-rebase-autostash.sh
+8
@@ -361,4 +361,12 @@ test_expect_success 'autostash with dirty submodules' '
361 git rebase -i --autostash HEAD
362 '
363
364 +test_expect_failure 'branch is left alone when possible' '
365 + git checkout -b unchanged-branch &&
366 + echo changed >file0 &&
367 + git rebase --autostash unchanged-branch &&
368 + test changed = "$(cat file0)" &&
369 + test unchanged-branch = "$(git rev-parse --abbrev-ref HEAD)"
370 +'
371 +
372 test_done