Skip to content

Commit f028d66

Browse files
phillipwoodgitster
authored andcommitted
cherry-pick: check commit error messages
We disallow partial commits and amending when CHERRY_PICK_HEAD exists. Add a couple of tests to check the error message printed in each case before we refactor the code responsible for this. Signed-off-by: Phillip Wood <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5b7a64d commit f028d66

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

t/t3507-cherry-pick-conflict.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,29 @@ test_expect_success 'successful commit clears CHERRY_PICK_HEAD' '
161161
162162
test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
163163
'
164+
165+
test_expect_success 'partial commit of cherry-pick fails' '
166+
pristine_detach initial &&
167+
168+
test_must_fail git cherry-pick picked &&
169+
echo resolved >foo &&
170+
git add foo &&
171+
test_must_fail git commit foo 2>err &&
172+
173+
test_i18ngrep "cannot do a partial commit during a cherry-pick." err
174+
'
175+
176+
test_expect_success 'commit --amend of cherry-pick fails' '
177+
pristine_detach initial &&
178+
179+
test_must_fail git cherry-pick picked &&
180+
echo resolved >foo &&
181+
git add foo &&
182+
test_must_fail git commit --amend 2>err &&
183+
184+
test_i18ngrep "in the middle of a cherry-pick -- cannot amend." err
185+
'
186+
164187
test_expect_success 'successful final commit clears cherry-pick state' '
165188
pristine_detach initial &&
166189

0 commit comments

Comments
 (0)