@@ -189,6 +189,46 @@ test_expect_success 'failed cherry-pick registers participants in index' '
189189 test_cmp expected actual
190190'
191191
192+ test_expect_success \
193+ ' cherry-pick conflict, ensure commit.cleanup = scissors places scissors line properly' '
194+ pristine_detach initial &&
195+ git config commit.cleanup scissors &&
196+ cat <<-EOF >expected &&
197+ picked
198+
199+ # ------------------------ >8 ------------------------
200+ # Do not modify or remove the line above.
201+ # Everything below it will be ignored.
202+ #
203+ # Conflicts:
204+ # foo
205+ EOF
206+
207+ test_must_fail git cherry-pick picked &&
208+
209+ test_i18ncmp expected .git/MERGE_MSG
210+ '
211+
212+ test_expect_success \
213+ ' cherry-pick conflict, ensure cleanup=scissors places scissors line properly' '
214+ pristine_detach initial &&
215+ git config --unset commit.cleanup &&
216+ cat <<-EOF >expected &&
217+ picked
218+
219+ # ------------------------ >8 ------------------------
220+ # Do not modify or remove the line above.
221+ # Everything below it will be ignored.
222+ #
223+ # Conflicts:
224+ # foo
225+ EOF
226+
227+ test_must_fail git cherry-pick --cleanup=scissors picked &&
228+
229+ test_i18ncmp expected .git/MERGE_MSG
230+ '
231+
192232test_expect_success ' failed cherry-pick describes conflict in work tree' '
193233 pristine_detach initial &&
194234 cat <<-EOF >expected &&
@@ -335,6 +375,52 @@ test_expect_success 'revert conflict, diff3 -m style' '
335375 test_cmp expected actual
336376'
337377
378+ test_expect_success \
379+ ' revert conflict, ensure commit.cleanup = scissors places scissors line properly' '
380+ pristine_detach initial &&
381+ git config commit.cleanup scissors &&
382+ cat >expected <<-EOF &&
383+ Revert "picked"
384+
385+ This reverts commit OBJID.
386+
387+ # ------------------------ >8 ------------------------
388+ # Do not modify or remove the line above.
389+ # Everything below it will be ignored.
390+ #
391+ # Conflicts:
392+ # foo
393+ EOF
394+
395+ test_must_fail git revert picked &&
396+
397+ sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
398+ test_i18ncmp expected actual
399+ '
400+
401+ test_expect_success \
402+ ' revert conflict, ensure cleanup=scissors places scissors line properly' '
403+ pristine_detach initial &&
404+ git config --unset commit.cleanup &&
405+ cat >expected <<-EOF &&
406+ Revert "picked"
407+
408+ This reverts commit OBJID.
409+
410+ # ------------------------ >8 ------------------------
411+ # Do not modify or remove the line above.
412+ # Everything below it will be ignored.
413+ #
414+ # Conflicts:
415+ # foo
416+ EOF
417+
418+ test_must_fail git revert --cleanup=scissors picked &&
419+
420+ sed "s/$OID_REGEX/OBJID/" .git/MERGE_MSG >actual &&
421+ test_i18ncmp expected actual
422+ '
423+
338424test_expect_success ' failed cherry-pick does not forget -s' '
339425 pristine_detach initial &&
340426 test_must_fail git cherry-pick -s picked &&
0 commit comments