Skip to content

Commit 1d968ca

Browse files
moygitster
authored andcommitted
rebase -i: demonstrate incorrect behavior of post-rewrite
The 'exec' command is sending the current commit to stopped-sha, which is supposed to contain the original commit (before rebase). As a result, if an 'exec' command fails, the next 'git rebase --continue' will send the current commit as <old-sha1> to the post-rewrite hook. The test currently fails with : --- expected.data 2015-05-21 17:55:29.000000000 +0000 +++ [...]post-rewrite.data 2015-05-21 17:55:29.000000000 +0000 @@ -1,2 +1,3 @@ 2362ae8e1b1b865e6161e6f0e165ffb974abf018 488028e9fac0b598b70cbeb594258a917e3f6fab +488028e9fac0b598b70cbeb594258a917e3f6fab 488028e9fac0b598b70cbeb594258a917e3f6fab babc8a4c7470895886fc129f1a015c486d05a351 8edffcc4e69a4e696a1d4bab047df450caf99507 Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 282616c commit 1d968ca

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

t/t5407-post-rewrite-hook.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,21 @@ EOF
212212
verify_hook_input
213213
'
214214

215+
test_expect_failure 'git rebase -i (exec)' '
216+
git reset --hard D &&
217+
clear_hook_input &&
218+
FAKE_LINES="edit 1 exec_false 2" git rebase -i B &&
219+
echo something >bar &&
220+
git add bar &&
221+
# Fails because of exec false
222+
test_must_fail git rebase --continue &&
223+
git rebase --continue &&
224+
echo rebase >expected.args &&
225+
cat >expected.data <<EOF &&
226+
$(git rev-parse C) $(git rev-parse HEAD^)
227+
$(git rev-parse D) $(git rev-parse HEAD)
228+
EOF
229+
verify_hook_input
230+
'
231+
215232
test_done

0 commit comments

Comments
 (0)