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