summaryrefslogtreecommitdiff
path: root/t/t5407-post-rewrite-hook.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-12-11 16:11:34 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-12-28 20:49:48 (GMT)
commit5400677903bdb852e0ca89e41e009afb8a1b6239 (patch)
tree44bf20644f96d6270b6bf443202bc19b989cece3 /t/t5407-post-rewrite-hook.sh
parent72ee67319f703201631b33697291720afd4e1d66 (diff)
downloadgit-5400677903bdb852e0ca89e41e009afb8a1b6239.zip
git-5400677903bdb852e0ca89e41e009afb8a1b6239.tar.gz
git-5400677903bdb852e0ca89e41e009afb8a1b6239.tar.bz2
t5407: add a test demonstrating how interactive handles --skip differently
The post-rewrite hook is documented as being invoked by commands that rewrite commits such as commit --amend and rebase, and that it will be called for each rewritten commit. Apparently, the three backends handled --skip'ed commits differently: am: treat the skipped commit as though it weren't rewritten merge: same as 'am' backend interactive: treat skipped commits as having been rewritten to empty (view them as an empty fixup to their parent) For now, just add a testcase documenting the different behavior (use --keep to force usage of the interactive machinery even though we have no empty commits). A subsequent commit will remove the inconsistency in --skip handling. Signed-off-by: Elijah Newren <newren@gmail.com> 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.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/t5407-post-rewrite-hook.sh b/t/t5407-post-rewrite-hook.sh
index 9b2a274..6426ec8 100755
--- a/t/t5407-post-rewrite-hook.sh
+++ b/t/t5407-post-rewrite-hook.sh
@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '
verify_hook_input
'
+test_expect_success 'git rebase with implicit use of interactive backend' '
+ git reset --hard D &&
+ clear_hook_input &&
+ test_must_fail git rebase --keep --onto A B &&
+ echo C > foo &&
+ git add foo &&
+ 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_expect_success 'git rebase --skip with implicit use of interactive backend' '
+ git reset --hard D &&
+ clear_hook_input &&
+ test_must_fail git rebase --keep --onto A B &&
+ test_must_fail git rebase --skip &&
+ echo D > foo &&
+ git add foo &&
+ 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_DIRECTORY"/lib-rebase.sh
set_fake_editor