Skip to content

Commit 5400677

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 72ee673 commit 5400677

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

t/t5407-post-rewrite-hook.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,37 @@ test_expect_success 'git rebase -m --skip' '
125125
verify_hook_input
126126
'
127127

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+
128159
. "$TEST_DIRECTORY"/lib-rebase.sh
129160

130161
set_fake_editor

0 commit comments

Comments
 (0)