]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3510-cherry-pick-sequence.sh
cherry-pick/revert: add --skip option
[thirdparty/git.git] / t / t3510-cherry-pick-sequence.sh
CommitLineData
04d3d3cf
RR
1#!/bin/sh
2
3test_description='Test cherry-pick continuation features
4
093a3091 5 + conflicting: rewrites unrelated to conflicting
539047c1 6 + yetanotherpick: rewrites foo to e
04d3d3cf
RR
7 + anotherpick: rewrites foo to d
8 + picked: rewrites foo to c
9 + unrelatedpick: rewrites unrelated to reallyunrelated
10 + base: rewrites foo to b
11 + initial: writes foo as a, unrelated as unrelated
12
13'
14
15. ./test-lib.sh
16
6bc1a235
RR
17# Repeat first match 10 times
18_r10='\1\1\1\1\1\1\1\1\1\1'
19
04d3d3cf 20pristine_detach () {
f80a8726 21 git cherry-pick --quit &&
04d3d3cf
RR
22 git checkout -f "$1^0" &&
23 git read-tree -u --reset HEAD &&
24 git clean -d -f -f -q -x
25}
26
27test_expect_success setup '
070bad6d 28 git config advice.detachedhead false &&
04d3d3cf
RR
29 echo unrelated >unrelated &&
30 git add unrelated &&
31 test_commit initial foo a &&
32 test_commit base foo b &&
33 test_commit unrelatedpick unrelated reallyunrelated &&
34 test_commit picked foo c &&
35 test_commit anotherpick foo d &&
539047c1 36 test_commit yetanotherpick foo e &&
093a3091
JN
37 pristine_detach initial &&
38 test_commit conflicting unrelated
04d3d3cf
RR
39'
40
41test_expect_success 'cherry-pick persists data on failure' '
42 pristine_detach initial &&
c6b7c7f3 43 test_expect_code 1 git cherry-pick -s base..anotherpick &&
04d3d3cf
RR
44 test_path_is_dir .git/sequencer &&
45 test_path_is_file .git/sequencer/head &&
6f032263
RR
46 test_path_is_file .git/sequencer/todo &&
47 test_path_is_file .git/sequencer/opts
48'
49
7acaaac2
JN
50test_expect_success 'cherry-pick mid-cherry-pick-sequence' '
51 pristine_detach initial &&
52 test_must_fail git cherry-pick base..anotherpick &&
53 test_cmp_rev picked CHERRY_PICK_HEAD &&
54 # "oops, I forgot that these patches rely on the change from base"
55 git checkout HEAD foo &&
56 git cherry-pick base &&
57 git cherry-pick picked &&
58 git cherry-pick --continue &&
59 git diff --exit-code anotherpick
60'
61
6f032263
RR
62test_expect_success 'cherry-pick persists opts correctly' '
63 pristine_detach initial &&
c812bd46
SO
64 # to make sure that the session to cherry-pick a sequence
65 # gets interrupted, use a high-enough number that is larger
66 # than the number of parents of any commit we have created
67 mainline=4 &&
68 test_expect_code 128 git cherry-pick -s -m $mainline --strategy=recursive -X patience -X ours initial..anotherpick &&
6f032263
RR
69 test_path_is_dir .git/sequencer &&
70 test_path_is_file .git/sequencer/head &&
71 test_path_is_file .git/sequencer/todo &&
72 test_path_is_file .git/sequencer/opts &&
73 echo "true" >expect &&
74 git config --file=.git/sequencer/opts --get-all options.signoff >actual &&
75 test_cmp expect actual &&
c812bd46 76 echo "$mainline" >expect &&
6f032263
RR
77 git config --file=.git/sequencer/opts --get-all options.mainline >actual &&
78 test_cmp expect actual &&
79 echo "recursive" >expect &&
80 git config --file=.git/sequencer/opts --get-all options.strategy >actual &&
81 test_cmp expect actual &&
82 cat >expect <<-\EOF &&
83 patience
84 ours
85 EOF
86 git config --file=.git/sequencer/opts --get-all options.strategy-option >actual &&
87 test_cmp expect actual
04d3d3cf
RR
88'
89
90test_expect_success 'cherry-pick cleans up sequencer state upon success' '
91 pristine_detach initial &&
92 git cherry-pick initial..picked &&
93 test_path_is_missing .git/sequencer
94'
95
de81ca3f
RA
96test_expect_success 'cherry-pick --skip requires cherry-pick in progress' '
97 pristine_detach initial &&
98 test_must_fail git cherry-pick --skip
99'
100
101test_expect_success 'revert --skip requires revert in progress' '
102 pristine_detach initial &&
103 test_must_fail git revert --skip
104'
105
106test_expect_success 'cherry-pick --skip to skip commit' '
107 pristine_detach initial &&
108 test_must_fail git cherry-pick anotherpick &&
109 test_must_fail git revert --skip &&
110 git cherry-pick --skip &&
111 test_cmp_rev initial HEAD &&
112 test_path_is_missing .git/CHERRY_PICK_HEAD
113'
114
115test_expect_success 'revert --skip to skip commit' '
116 pristine_detach anotherpick &&
117 test_must_fail git revert anotherpick~1 &&
118 test_must_fail git cherry-pick --skip &&
119 git revert --skip &&
120 test_cmp_rev anotherpick HEAD
121'
122
123test_expect_success 'skip "empty" commit' '
124 pristine_detach picked &&
125 test_commit dummy foo d &&
126 test_must_fail git cherry-pick anotherpick &&
127 git cherry-pick --skip &&
128 test_cmp_rev dummy HEAD
129'
130
131test_expect_success 'skip a commit and check if rest of sequence is correct' '
132 pristine_detach initial &&
133 echo e >expect &&
134 cat >expect.log <<-EOF &&
135 OBJID
136 :100644 100644 OBJID OBJID M foo
137 OBJID
138 :100644 100644 OBJID OBJID M foo
139 OBJID
140 :100644 100644 OBJID OBJID M unrelated
141 OBJID
142 :000000 100644 OBJID OBJID A foo
143 :000000 100644 OBJID OBJID A unrelated
144 EOF
145 test_must_fail git cherry-pick base..yetanotherpick &&
146 test_must_fail git cherry-pick --skip &&
147 echo d >foo &&
148 git add foo &&
149 git cherry-pick --continue &&
150 {
151 git rev-list HEAD |
152 git diff-tree --root --stdin |
153 sed "s/$OID_REGEX/OBJID/g"
154 } >actual.log &&
155 test_cmp expect foo &&
156 test_cmp expect.log actual.log
157'
158
159test_expect_success 'check advice when we move HEAD by committing' '
160 pristine_detach initial &&
161 cat >expect <<-EOF &&
162 error: there is nothing to skip
163 hint: have you committed already?
164 hint: try "git cherry-pick --continue"
165 fatal: cherry-pick failed
166 EOF
167 test_must_fail git cherry-pick base..yetanotherpick &&
168 echo c >foo &&
169 git commit -a &&
170 test_path_is_missing .git/CHERRY_PICK_HEAD &&
171 test_must_fail git cherry-pick --skip 2>advice &&
172 test_i18ncmp expect advice
173'
174
175test_expect_success 'allow skipping commit but not abort for a new history' '
176 pristine_detach initial &&
177 cat >expect <<-EOF &&
178 error: cannot abort from a branch yet to be born
179 fatal: cherry-pick failed
180 EOF
181 git checkout --orphan new_disconnected &&
182 git reset --hard &&
183 test_must_fail git cherry-pick anotherpick &&
184 test_must_fail git cherry-pick --abort 2>advice &&
185 git cherry-pick --skip &&
186 test_i18ncmp expect advice
187'
188
189test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
190 pristine_detach initial &&
191 git rm --cached unrelated &&
192 git commit -m "untrack unrelated" &&
193 test_must_fail git cherry-pick initial base &&
194 test_path_is_missing .git/CHERRY_PICK_HEAD &&
195 git cherry-pick --skip
196'
197
f80a8726 198test_expect_success '--quit does not complain when no cherry-pick is in progress' '
26ae337b 199 pristine_detach initial &&
f80a8726 200 git cherry-pick --quit
26ae337b
RR
201'
202
539047c1
JN
203test_expect_success '--abort requires cherry-pick in progress' '
204 pristine_detach initial &&
205 test_must_fail git cherry-pick --abort
206'
207
f80a8726 208test_expect_success '--quit cleans up sequencer state' '
26ae337b 209 pristine_detach initial &&
c6b7c7f3 210 test_expect_code 1 git cherry-pick base..picked &&
f80a8726 211 git cherry-pick --quit &&
3e7dd992
NTND
212 test_path_is_missing .git/sequencer &&
213 test_path_is_missing .git/CHERRY_PICK_HEAD
26ae337b
RR
214'
215
c427b211 216test_expect_success '--quit keeps HEAD and conflicted index intact' '
f80a8726
JN
217 pristine_detach initial &&
218 cat >expect <<-\EOF &&
219 OBJID
220 :100644 100644 OBJID OBJID M unrelated
221 OBJID
222 :000000 100644 OBJID OBJID A foo
223 :000000 100644 OBJID OBJID A unrelated
224 EOF
c6b7c7f3 225 test_expect_code 1 git cherry-pick base..picked &&
c427b211 226 git cherry-pick --quit &&
f80a8726
JN
227 test_path_is_missing .git/sequencer &&
228 test_must_fail git update-index --refresh &&
229 {
230 git rev-list HEAD |
231 git diff-tree --root --stdin |
2ece6ad2 232 sed "s/$OID_REGEX/OBJID/g"
f80a8726
JN
233 } >actual &&
234 test_cmp expect actual
235'
236
539047c1
JN
237test_expect_success '--abort to cancel multiple cherry-pick' '
238 pristine_detach initial &&
c6b7c7f3 239 test_expect_code 1 git cherry-pick base..anotherpick &&
539047c1
JN
240 git cherry-pick --abort &&
241 test_path_is_missing .git/sequencer &&
3e7dd992 242 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
243 test_cmp_rev initial HEAD &&
244 git update-index --refresh &&
245 git diff-index --exit-code HEAD
246'
247
248test_expect_success '--abort to cancel single cherry-pick' '
249 pristine_detach initial &&
c6b7c7f3 250 test_expect_code 1 git cherry-pick picked &&
539047c1
JN
251 git cherry-pick --abort &&
252 test_path_is_missing .git/sequencer &&
3e7dd992 253 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
254 test_cmp_rev initial HEAD &&
255 git update-index --refresh &&
256 git diff-index --exit-code HEAD
257'
258
1e41229d 259test_expect_success '--abort does not unsafely change HEAD' '
aeebd98e
SB
260 pristine_detach initial &&
261 test_must_fail git cherry-pick picked anotherpick &&
262 git reset --hard base &&
263 test_must_fail git cherry-pick picked anotherpick &&
264 git cherry-pick --abort 2>actual &&
265 test_i18ngrep "You seem to have moved HEAD" actual &&
266 test_cmp_rev base HEAD
267'
268
539047c1
JN
269test_expect_success 'cherry-pick --abort to cancel multiple revert' '
270 pristine_detach anotherpick &&
c6b7c7f3 271 test_expect_code 1 git revert base..picked &&
539047c1
JN
272 git cherry-pick --abort &&
273 test_path_is_missing .git/sequencer &&
3e7dd992 274 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
275 test_cmp_rev anotherpick HEAD &&
276 git update-index --refresh &&
277 git diff-index --exit-code HEAD
278'
279
280test_expect_success 'revert --abort works, too' '
281 pristine_detach anotherpick &&
c6b7c7f3 282 test_expect_code 1 git revert base..picked &&
539047c1
JN
283 git revert --abort &&
284 test_path_is_missing .git/sequencer &&
285 test_cmp_rev anotherpick HEAD
286'
287
288test_expect_success '--abort to cancel single revert' '
289 pristine_detach anotherpick &&
c6b7c7f3 290 test_expect_code 1 git revert picked &&
539047c1
JN
291 git revert --abort &&
292 test_path_is_missing .git/sequencer &&
293 test_cmp_rev anotherpick HEAD &&
294 git update-index --refresh &&
295 git diff-index --exit-code HEAD
296'
297
298test_expect_success '--abort keeps unrelated change, easy case' '
299 pristine_detach unrelatedpick &&
300 echo changed >expect &&
c6b7c7f3 301 test_expect_code 1 git cherry-pick picked..yetanotherpick &&
539047c1
JN
302 echo changed >unrelated &&
303 git cherry-pick --abort &&
304 test_cmp expect unrelated
305'
306
307test_expect_success '--abort refuses to clobber unrelated change, harder case' '
308 pristine_detach initial &&
309 echo changed >expect &&
c6b7c7f3 310 test_expect_code 1 git cherry-pick base..anotherpick &&
539047c1
JN
311 echo changed >unrelated &&
312 test_must_fail git cherry-pick --abort &&
313 test_cmp expect unrelated &&
314 git rev-list HEAD >log &&
315 test_line_count = 2 log &&
316 test_must_fail git update-index --refresh &&
317
318 git checkout unrelated &&
319 git cherry-pick --abort &&
320 test_cmp_rev initial HEAD
321'
322
218b65fb 323test_expect_success 'cherry-pick still writes sequencer state when one commit is left' '
2d27daa9 324 pristine_detach initial &&
c6b7c7f3 325 test_expect_code 1 git cherry-pick base..picked &&
218b65fb 326 test_path_is_dir .git/sequencer &&
2d27daa9
RR
327 echo "resolved" >foo &&
328 git add foo &&
329 git commit &&
330 {
331 git rev-list HEAD |
332 git diff-tree --root --stdin |
2ece6ad2 333 sed "s/$OID_REGEX/OBJID/g"
2d27daa9
RR
334 } >actual &&
335 cat >expect <<-\EOF &&
336 OBJID
337 :100644 100644 OBJID OBJID M foo
338 OBJID
339 :100644 100644 OBJID OBJID M unrelated
340 OBJID
341 :000000 100644 OBJID OBJID A foo
342 :000000 100644 OBJID OBJID A unrelated
343 EOF
344 test_cmp expect actual
345'
346
218b65fb 347test_expect_success '--abort after last commit in sequence' '
539047c1 348 pristine_detach initial &&
c6b7c7f3 349 test_expect_code 1 git cherry-pick base..picked &&
539047c1
JN
350 git cherry-pick --abort &&
351 test_path_is_missing .git/sequencer &&
3e7dd992 352 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
353 test_cmp_rev initial HEAD &&
354 git update-index --refresh &&
355 git diff-index --exit-code HEAD
356'
357
21afd080
RR
358test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
359 pristine_detach initial &&
c6b7c7f3 360 test_expect_code 1 git cherry-pick base..anotherpick &&
deb9845a 361 test-tool chmtime --get .git/sequencer >expect &&
c6b7c7f3 362 test_expect_code 128 git cherry-pick unrelatedpick &&
deb9845a 363 test-tool chmtime --get .git/sequencer >actual &&
21afd080
RR
364 test_cmp expect actual
365'
366
5a5d80f4
RR
367test_expect_success '--continue complains when no cherry-pick is in progress' '
368 pristine_detach initial &&
c6b7c7f3 369 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
370'
371
372test_expect_success '--continue complains when there are unresolved conflicts' '
373 pristine_detach initial &&
c6b7c7f3
RR
374 test_expect_code 1 git cherry-pick base..anotherpick &&
375 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
376'
377
093a3091
JN
378test_expect_success '--continue of single cherry-pick' '
379 pristine_detach initial &&
380 echo c >expect &&
381 test_must_fail git cherry-pick picked &&
382 echo c >foo &&
383 git add foo &&
384 git cherry-pick --continue &&
385
386 test_cmp expect foo &&
387 test_cmp_rev initial HEAD^ &&
388 git diff --exit-code HEAD &&
389 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
390'
391
392test_expect_success '--continue of single revert' '
393 pristine_detach initial &&
394 echo resolved >expect &&
395 echo "Revert \"picked\"" >expect.msg &&
396 test_must_fail git revert picked &&
397 echo resolved >foo &&
398 git add foo &&
399 git cherry-pick --continue &&
400
401 git diff --exit-code HEAD &&
402 test_cmp expect foo &&
403 test_cmp_rev initial HEAD^ &&
404 git diff-tree -s --pretty=tformat:%s HEAD >msg &&
405 test_cmp expect.msg msg &&
406 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
407 test_must_fail git rev-parse --verify REVERT_HEAD
408'
409
410test_expect_success '--continue after resolving conflicts' '
411 pristine_detach initial &&
412 echo d >expect &&
413 cat >expect.log <<-\EOF &&
414 OBJID
415 :100644 100644 OBJID OBJID M foo
416 OBJID
417 :100644 100644 OBJID OBJID M foo
418 OBJID
419 :100644 100644 OBJID OBJID M unrelated
420 OBJID
421 :000000 100644 OBJID OBJID A foo
422 :000000 100644 OBJID OBJID A unrelated
423 EOF
424 test_must_fail git cherry-pick base..anotherpick &&
425 echo c >foo &&
426 git add foo &&
427 git cherry-pick --continue &&
428 {
429 git rev-list HEAD |
430 git diff-tree --root --stdin |
2ece6ad2 431 sed "s/$OID_REGEX/OBJID/g"
093a3091
JN
432 } >actual.log &&
433 test_cmp expect foo &&
434 test_cmp expect.log actual.log
435'
436
437test_expect_success '--continue after resolving conflicts and committing' '
5a5d80f4 438 pristine_detach initial &&
c6b7c7f3 439 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
440 echo "c" >foo &&
441 git add foo &&
442 git commit &&
443 git cherry-pick --continue &&
444 test_path_is_missing .git/sequencer &&
445 {
446 git rev-list HEAD |
447 git diff-tree --root --stdin |
2ece6ad2 448 sed "s/$OID_REGEX/OBJID/g"
5a5d80f4
RR
449 } >actual &&
450 cat >expect <<-\EOF &&
451 OBJID
452 :100644 100644 OBJID OBJID M foo
453 OBJID
454 :100644 100644 OBJID OBJID M foo
455 OBJID
456 :100644 100644 OBJID OBJID M unrelated
457 OBJID
458 :000000 100644 OBJID OBJID A foo
459 :000000 100644 OBJID OBJID A unrelated
460 EOF
461 test_cmp expect actual
462'
463
093a3091
JN
464test_expect_success '--continue asks for help after resolving patch to nil' '
465 pristine_detach conflicting &&
466 test_must_fail git cherry-pick initial..picked &&
467
468 test_cmp_rev unrelatedpick CHERRY_PICK_HEAD &&
469 git checkout HEAD -- unrelated &&
470 test_must_fail git cherry-pick --continue 2>msg &&
471 test_i18ngrep "The previous cherry-pick is now empty" msg
472'
473
a7eff1e0 474test_expect_success 'follow advice and skip nil patch' '
093a3091
JN
475 pristine_detach conflicting &&
476 test_must_fail git cherry-pick initial..picked &&
477
478 git checkout HEAD -- unrelated &&
479 test_must_fail git cherry-pick --continue &&
480 git reset &&
481 git cherry-pick --continue &&
482
483 git rev-list initial..HEAD >commits &&
484 test_line_count = 3 commits
485'
486
5a5d80f4
RR
487test_expect_success '--continue respects opts' '
488 pristine_detach initial &&
c6b7c7f3 489 test_expect_code 1 git cherry-pick -x base..anotherpick &&
5a5d80f4
RR
490 echo "c" >foo &&
491 git add foo &&
492 git commit &&
493 git cherry-pick --continue &&
494 test_path_is_missing .git/sequencer &&
495 git cat-file commit HEAD >anotherpick_msg &&
496 git cat-file commit HEAD~1 >picked_msg &&
497 git cat-file commit HEAD~2 >unrelatedpick_msg &&
498 git cat-file commit HEAD~3 >initial_msg &&
c7cf9566 499 ! grep "cherry picked from" initial_msg &&
5a5d80f4
RR
500 grep "cherry picked from" unrelatedpick_msg &&
501 grep "cherry picked from" picked_msg &&
502 grep "cherry picked from" anotherpick_msg
503'
504
093a3091
JN
505test_expect_success '--continue of single-pick respects -x' '
506 pristine_detach initial &&
507 test_must_fail git cherry-pick -x picked &&
508 echo c >foo &&
509 git add foo &&
510 git cherry-pick --continue &&
511 test_path_is_missing .git/sequencer &&
512 git cat-file commit HEAD >msg &&
513 grep "cherry picked from" msg
514'
515
516test_expect_success '--continue respects -x in first commit in multi-pick' '
517 pristine_detach initial &&
518 test_must_fail git cherry-pick -x picked anotherpick &&
519 echo c >foo &&
520 git add foo &&
521 git cherry-pick --continue &&
522 test_path_is_missing .git/sequencer &&
523 git cat-file commit HEAD^ >msg &&
524 picked=$(git rev-parse --verify picked) &&
525 grep "cherry picked from.*$picked" msg
526'
527
5ed75e2a 528test_expect_failure '--signoff is automatically propagated to resolved conflict' '
5a5d80f4 529 pristine_detach initial &&
c6b7c7f3 530 test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
5a5d80f4
RR
531 echo "c" >foo &&
532 git add foo &&
533 git commit &&
534 git cherry-pick --continue &&
535 test_path_is_missing .git/sequencer &&
536 git cat-file commit HEAD >anotherpick_msg &&
537 git cat-file commit HEAD~1 >picked_msg &&
538 git cat-file commit HEAD~2 >unrelatedpick_msg &&
539 git cat-file commit HEAD~3 >initial_msg &&
c7cf9566 540 ! grep "Signed-off-by:" initial_msg &&
5a5d80f4 541 grep "Signed-off-by:" unrelatedpick_msg &&
c7cf9566 542 ! grep "Signed-off-by:" picked_msg &&
5a5d80f4
RR
543 grep "Signed-off-by:" anotherpick_msg
544'
545
5ed75e2a 546test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
093a3091
JN
547 pristine_detach initial &&
548 test_must_fail git cherry-pick -s picked anotherpick &&
549 echo c >foo &&
550 git add foo &&
551 git cherry-pick --continue &&
552
553 git diff --exit-code HEAD &&
554 test_cmp_rev initial HEAD^^ &&
555 git cat-file commit HEAD^ >msg &&
556 ! grep Signed-off-by: msg
557'
558
5ed75e2a 559test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
093a3091
JN
560 pristine_detach initial &&
561 test_must_fail git cherry-pick -s picked &&
562 echo c >foo &&
563 git add foo &&
564 git cherry-pick --continue &&
565
566 git diff --exit-code HEAD &&
567 test_cmp_rev initial HEAD^ &&
568 git cat-file commit HEAD >msg &&
569 ! grep Signed-off-by: msg
570'
571
5a5d80f4
RR
572test_expect_success 'malformed instruction sheet 1' '
573 pristine_detach initial &&
c6b7c7f3 574 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
575 echo "resolved" >foo &&
576 git add foo &&
577 git commit &&
578 sed "s/pick /pick/" .git/sequencer/todo >new_sheet &&
579 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 580 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
581'
582
583test_expect_success 'malformed instruction sheet 2' '
584 pristine_detach initial &&
c6b7c7f3 585 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
586 echo "resolved" >foo &&
587 git add foo &&
588 git commit &&
589 sed "s/pick/revert/" .git/sequencer/todo >new_sheet &&
590 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 591 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
592'
593
8530c739 594test_expect_success 'empty commit set (no commits to walk)' '
7f13334e
JN
595 pristine_detach initial &&
596 test_expect_code 128 git cherry-pick base..base
597'
598
8530c739
JK
599test_expect_success 'empty commit set (culled during walk)' '
600 pristine_detach initial &&
601 test_expect_code 128 git cherry-pick -2 --author=no.such.author base
602'
603
6bc1a235
RR
604test_expect_success 'malformed instruction sheet 3' '
605 pristine_detach initial &&
c6b7c7f3 606 test_expect_code 1 git cherry-pick base..anotherpick &&
6bc1a235
RR
607 echo "resolved" >foo &&
608 git add foo &&
609 git commit &&
610 sed "s/pick \([0-9a-f]*\)/pick $_r10/" .git/sequencer/todo >new_sheet &&
611 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 612 test_expect_code 128 git cherry-pick --continue
6bc1a235
RR
613'
614
0db76962
RR
615test_expect_success 'instruction sheet, fat-fingers version' '
616 pristine_detach initial &&
c6b7c7f3 617 test_expect_code 1 git cherry-pick base..anotherpick &&
0db76962
RR
618 echo "c" >foo &&
619 git add foo &&
620 git commit &&
621 sed "s/pick \([0-9a-f]*\)/pick \1 /" .git/sequencer/todo >new_sheet &&
622 cp new_sheet .git/sequencer/todo &&
623 git cherry-pick --continue
624'
625
6bc1a235
RR
626test_expect_success 'commit descriptions in insn sheet are optional' '
627 pristine_detach initial &&
c6b7c7f3 628 test_expect_code 1 git cherry-pick base..anotherpick &&
6bc1a235
RR
629 echo "c" >foo &&
630 git add foo &&
631 git commit &&
632 cut -d" " -f1,2 .git/sequencer/todo >new_sheet &&
633 cp new_sheet .git/sequencer/todo &&
634 git cherry-pick --continue &&
635 test_path_is_missing .git/sequencer &&
636 git rev-list HEAD >commits &&
637 test_line_count = 4 commits
638'
639
04d3d3cf 640test_done