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>

Elijah Newren committed Dec 11, 2018 at 08:11 UTC 5400677903bdb852e0ca89e41e009afb8a1b6239
1 file changed +31
t/t5407-post-rewrite-hook.sh
+31
@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '
125 verify_hook_input
126 '
127
128 +test_expect_success 'git rebase with implicit use of interactive backend' '
129 + git reset --hard D &&
130 + clear_hook_input &&
131 + test_must_fail git rebase --keep --onto A B &&
132 + echo C > foo &&
133 + git add foo &&
134 + git rebase --continue &&
135 + echo rebase >expected.args &&
136 + cat >expected.data <<-EOF &&
137 + $(git rev-parse C) $(git rev-parse HEAD^)
138 + $(git rev-parse D) $(git rev-parse HEAD)
139 + EOF
140 + verify_hook_input
141 +'
142 +
143 +test_expect_success 'git rebase --skip with implicit use of interactive backend' '
144 + git reset --hard D &&
145 + clear_hook_input &&
146 + test_must_fail git rebase --keep --onto A B &&
147 + test_must_fail git rebase --skip &&
148 + echo D > foo &&
149 + git add foo &&
150 + git rebase --continue &&
151 + echo rebase >expected.args &&
152 + cat >expected.data <<-EOF &&
153 + $(git rev-parse C) $(git rev-parse HEAD^)
154 + $(git rev-parse D) $(git rev-parse HEAD)
155 + EOF
156 + verify_hook_input
157 +'
158 +
159 . "$TEST_DIRECTORY"/lib-rebase.sh
160
161 set_fake_editor