built-in rebase: demonstrate that ORIG_HEAD is not set correctly

The ORIG_HEAD pseudo ref is supposed to refer to the original, pre-rebase state after a successful rebase. Let's add a regression test to prove that this regressed: With GIT_TEST_REBASE_USE_BUILTIN=false, this test case passes, with GIT_TEST_REBASE_USE_BUILTIN=true (or unset), it fails. Reported by Nazri Ramliy. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Mar 3, 2019 at 09:11 UTC c2d96293602bf6e8ffa1002cff8cb6faa3854815
1 file changed +8
t/t3400-rebase.sh
+8
@@ -59,6 +59,14 @@ test_expect_success 'rebase against master' '
59 git rebase master
60 '
61
62 +test_expect_failure 'rebase sets ORIG_HEAD to pre-rebase state' '
63 + git checkout -b orig-head topic &&
64 + pre="$(git rev-parse --verify HEAD)" &&
65 + git rebase master &&
66 + test_cmp_rev "$pre" ORIG_HEAD &&
67 + ! test_cmp_rev "$pre" HEAD
68 +'
69 +
70 test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
71 test_when_finished "git branch -D torebase" &&
72 git checkout -b torebase my-topic-branch^ &&