built-in rebase: demonstrate that ORIG_HEAD is not set correctly
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sun, 3 Mar 2019 17:11:54 +0000 (09:11 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 4 Mar 2019 04:31:04 +0000 (13:31 +0900)
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>
t/t3400-rebase.sh
index 3e73f7584ce7d3a23e7e75d0f71bd595f5f822a3..7e8d5bb200e35ef46a48cae3ebd423f312022bce 100755 (executable)
@@ -59,6 +59,14 @@ test_expect_success 'rebase against master' '
        git rebase master
 '
 
+test_expect_failure 'rebase sets ORIG_HEAD to pre-rebase state' '
+       git checkout -b orig-head topic &&
+       pre="$(git rev-parse --verify HEAD)" &&
+       git rebase master &&
+       test_cmp_rev "$pre" ORIG_HEAD &&
+       ! test_cmp_rev "$pre" HEAD
+'
+
 test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
        test_when_finished "git branch -D torebase" &&
        git checkout -b torebase my-topic-branch^ &&