Skip to content

Commit f90924e

Browse files
committed
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 <[email protected]>
1 parent 65468c1 commit f90924e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

t/t3400-rebase.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ test_expect_success 'rebase against master' '
5959
git rebase master
6060
'
6161

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+
6270
test_expect_success 'rebase, with <onto> and <upstream> specified as :/quuxery' '
6371
test_when_finished "git branch -D torebase" &&
6472
git checkout -b torebase my-topic-branch^ &&

0 commit comments

Comments
 (0)