summaryrefslogtreecommitdiff
path: root/t/t5407-post-rewrite-hook.sh
diff options
context:
space:
mode:
authorMatthieu Moy <Matthieu.Moy@imag.fr>2015-05-22 13:15:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-05-22 15:39:01 (GMT)
commit1d968ca69809ffb7b9105a4785aa0bc3b37b1434 (patch)
tree8752b83e629304d5a64cb13406fcb3dd1b4e1aef /t/t5407-post-rewrite-hook.sh
parent282616c72d1d08a77ca4fe1186cb708c38408d87 (diff)
downloadgit-1d968ca69809ffb7b9105a4785aa0bc3b37b1434.zip
git-1d968ca69809ffb7b9105a4785aa0bc3b37b1434.tar.gz
git-1d968ca69809ffb7b9105a4785aa0bc3b37b1434.tar.bz2
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 <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5407-post-rewrite-hook.sh')
-rwxr-xr-xt/t5407-post-rewrite-hook.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
index ea2e0d4..53a4062 100755
--- a/t/t5407-post-rewrite-hook.sh
+++ b/t/t5407-post-rewrite-hook.sh
@@ -212,4 +212,21 @@ EOF
verify_hook_input
'
+test_expect_failure 'git rebase -i (exec)' '
+ git reset --hard D &&
+ clear_hook_input &&
+ FAKE_LINES="edit 1 exec_false 2" git rebase -i B &&
+ echo something >bar &&
+ git add bar &&
+ # Fails because of exec false
+ test_must_fail git rebase --continue &&
+ git rebase --continue &&
+ echo rebase >expected.args &&
+ cat >expected.data <<EOF &&
+$(git rev-parse C) $(git rev-parse HEAD^)
+$(git rev-parse D) $(git rev-parse HEAD)
+EOF
+ verify_hook_input
+'
+
test_done