Merge branch 'jk/prune-with-bitmap-fix'
[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_i18ngrep "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         pristine_detach initial &&
242         git rm --cached unrelated &&
243         git commit -m "untrack unrelated" &&
244         test_must_fail git cherry-pick initial base &&
245         test_path_is_missing .git/CHERRY_PICK_HEAD &&
246         git cherry-pick --skip
247 '
248
249 test_expect_success '--quit does not complain when no cherry-pick is in progress' '
250         pristine_detach initial &&
251         git cherry-pick --quit
252 '
253
254 test_expect_success '--abort requires cherry-pick in progress' '
255         pristine_detach initial &&
256         test_must_fail git cherry-pick --abort
257 '
258
259 test_expect_success '--quit cleans up sequencer state' '
260         pristine_detach initial &&
261         test_expect_code 1 git cherry-pick base..picked &&
262         git cherry-pick --quit &&
263         test_path_is_missing .git/sequencer &&
264         test_path_is_missing .git/CHERRY_PICK_HEAD
265 '
266
267 test_expect_success '--quit keeps HEAD and conflicted index intact' '
268         pristine_detach initial &&
269         cat >expect <<-\EOF &&
270         OBJID
271         :100644 100644 OBJID OBJID M    unrelated
272         OBJID
273         :000000 100644 OBJID OBJID A    foo
274         :000000 100644 OBJID OBJID A    unrelated
275         EOF
276         test_expect_code 1 git cherry-pick base..picked &&
277         git cherry-pick --quit &&
278         test_path_is_missing .git/sequencer &&
279         test_must_fail git update-index --refresh &&
280         {
281                 git rev-list HEAD |
282                 git diff-tree --root --stdin |
283                 sed "s/$OID_REGEX/OBJID/g"
284         } >actual &&
285         test_cmp expect actual
286 '
287
288 test_expect_success '--abort to cancel multiple cherry-pick' '
289         pristine_detach initial &&
290         test_expect_code 1 git cherry-pick base..anotherpick &&
291         git cherry-pick --abort &&
292         test_path_is_missing .git/sequencer &&
293         test_path_is_missing .git/CHERRY_PICK_HEAD &&
294         test_cmp_rev initial HEAD &&
295         git update-index --refresh &&
296         git diff-index --exit-code HEAD
297 '
298
299 test_expect_success '--abort to cancel single cherry-pick' '
300         pristine_detach initial &&
301         test_expect_code 1 git cherry-pick picked &&
302         git cherry-pick --abort &&
303         test_path_is_missing .git/sequencer &&
304         test_path_is_missing .git/CHERRY_PICK_HEAD &&
305         test_cmp_rev initial HEAD &&
306         git update-index --refresh &&
307         git diff-index --exit-code HEAD
308 '
309
310 test_expect_success '--abort does not unsafely change HEAD' '
311         pristine_detach initial &&
312         test_must_fail git cherry-pick picked anotherpick &&
313         git reset --hard base &&
314         test_must_fail git cherry-pick picked anotherpick &&
315         git cherry-pick --abort 2>actual &&
316         test_i18ngrep "You seem to have moved HEAD" actual &&
317         test_cmp_rev base HEAD
318 '
319
320 test_expect_success 'cherry-pick --abort to cancel multiple revert' '
321         pristine_detach anotherpick &&
322         test_expect_code 1 git revert base..picked &&
323         git cherry-pick --abort &&
324         test_path_is_missing .git/sequencer &&
325         test_path_is_missing .git/CHERRY_PICK_HEAD &&
326         test_cmp_rev anotherpick HEAD &&
327         git update-index --refresh &&
328         git diff-index --exit-code HEAD
329 '
330
331 test_expect_success 'revert --abort works, too' '
332         pristine_detach anotherpick &&
333         test_expect_code 1 git revert base..picked &&
334         git revert --abort &&
335         test_path_is_missing .git/sequencer &&
336         test_cmp_rev anotherpick HEAD
337 '
338
339 test_expect_success '--abort to cancel single revert' '
340         pristine_detach anotherpick &&
341         test_expect_code 1 git revert picked &&
342         git revert --abort &&
343         test_path_is_missing .git/sequencer &&
344         test_cmp_rev anotherpick HEAD &&
345         git update-index --refresh &&
346         git diff-index --exit-code HEAD
347 '
348
349 test_expect_success '--abort keeps unrelated change, easy case' '
350         pristine_detach unrelatedpick &&
351         echo changed >expect &&
352         test_expect_code 1 git cherry-pick picked..yetanotherpick &&
353         echo changed >unrelated &&
354         git cherry-pick --abort &&
355         test_cmp expect unrelated
356 '
357
358 test_expect_success '--abort refuses to clobber unrelated change, harder case' '
359         pristine_detach initial &&
360         echo changed >expect &&
361         test_expect_code 1 git cherry-pick base..anotherpick &&
362         echo changed >unrelated &&
363         test_must_fail git cherry-pick --abort &&
364         test_cmp expect unrelated &&
365         git rev-list HEAD >log &&
366         test_line_count = 2 log &&
367         test_must_fail git update-index --refresh &&
368
369         git checkout unrelated &&
370         git cherry-pick --abort &&
371         test_cmp_rev initial HEAD
372 '
373
374 test_expect_success 'cherry-pick still writes sequencer state when one commit is left' '
375         pristine_detach initial &&
376         test_expect_code 1 git cherry-pick base..picked &&
377         test_path_is_dir .git/sequencer &&
378         echo "resolved" >foo &&
379         git add foo &&
380         git commit &&
381         {
382                 git rev-list HEAD |
383                 git diff-tree --root --stdin |
384                 sed "s/$OID_REGEX/OBJID/g"
385         } >actual &&
386         cat >expect <<-\EOF &&
387         OBJID
388         :100644 100644 OBJID OBJID M    foo
389         OBJID
390         :100644 100644 OBJID OBJID M    unrelated
391         OBJID
392         :000000 100644 OBJID OBJID A    foo
393         :000000 100644 OBJID OBJID A    unrelated
394         EOF
395         test_cmp expect actual
396 '
397
398 test_expect_success '--abort after last commit in sequence' '
399         pristine_detach initial &&
400         test_expect_code 1 git cherry-pick base..picked &&
401         git cherry-pick --abort &&
402         test_path_is_missing .git/sequencer &&
403         test_path_is_missing .git/CHERRY_PICK_HEAD &&
404         test_cmp_rev initial HEAD &&
405         git update-index --refresh &&
406         git diff-index --exit-code HEAD
407 '
408
409 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
410         pristine_detach initial &&
411         test_expect_code 1 git cherry-pick base..anotherpick &&
412         test-tool chmtime --get .git/sequencer >expect &&
413         test_expect_code 128 git cherry-pick unrelatedpick &&
414         test-tool chmtime --get .git/sequencer >actual &&
415         test_cmp expect actual
416 '
417
418 test_expect_success '--continue complains when no cherry-pick is in progress' '
419         pristine_detach initial &&
420         test_expect_code 128 git cherry-pick --continue
421 '
422
423 test_expect_success '--continue complains when there are unresolved conflicts' '
424         pristine_detach initial &&
425         test_expect_code 1 git cherry-pick base..anotherpick &&
426         test_expect_code 128 git cherry-pick --continue
427 '
428
429 test_expect_success '--continue of single cherry-pick' '
430         pristine_detach initial &&
431         echo c >expect &&
432         test_must_fail git cherry-pick picked &&
433         echo c >foo &&
434         git add foo &&
435         git cherry-pick --continue &&
436
437         test_cmp expect foo &&
438         test_cmp_rev initial HEAD^ &&
439         git diff --exit-code HEAD &&
440         test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
441 '
442
443 test_expect_success '--continue of single revert' '
444         pristine_detach initial &&
445         echo resolved >expect &&
446         echo "Revert \"picked\"" >expect.msg &&
447         test_must_fail git revert picked &&
448         echo resolved >foo &&
449         git add foo &&
450         git cherry-pick --continue &&
451
452         git diff --exit-code HEAD &&
453         test_cmp expect foo &&
454         test_cmp_rev initial HEAD^ &&
455         git diff-tree -s --pretty=tformat:%s HEAD >msg &&
456         test_cmp expect.msg msg &&
457         test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
458         test_must_fail git rev-parse --verify REVERT_HEAD
459 '
460
461 test_expect_success '--continue after resolving conflicts' '
462         pristine_detach initial &&
463         echo d >expect &&
464         cat >expect.log <<-\EOF &&
465         OBJID
466         :100644 100644 OBJID OBJID M    foo
467         OBJID
468         :100644 100644 OBJID OBJID M    foo
469         OBJID
470         :100644 100644 OBJID OBJID M    unrelated
471         OBJID
472         :000000 100644 OBJID OBJID A    foo
473         :000000 100644 OBJID OBJID A    unrelated
474         EOF
475         test_must_fail git cherry-pick base..anotherpick &&
476         echo c >foo &&
477         git add foo &&
478         git cherry-pick --continue &&
479         {
480                 git rev-list HEAD |
481                 git diff-tree --root --stdin |
482                 sed "s/$OID_REGEX/OBJID/g"
483         } >actual.log &&
484         test_cmp expect foo &&
485         test_cmp expect.log actual.log
486 '
487
488 test_expect_success '--continue after resolving conflicts and committing' '
489         pristine_detach initial &&
490         test_expect_code 1 git cherry-pick base..anotherpick &&
491         echo "c" >foo &&
492         git add foo &&
493         git commit &&
494         git cherry-pick --continue &&
495         test_path_is_missing .git/sequencer &&
496         {
497                 git rev-list HEAD |
498                 git diff-tree --root --stdin |
499                 sed "s/$OID_REGEX/OBJID/g"
500         } >actual &&
501         cat >expect <<-\EOF &&
502         OBJID
503         :100644 100644 OBJID OBJID M    foo
504         OBJID
505         :100644 100644 OBJID OBJID M    foo
506         OBJID
507         :100644 100644 OBJID OBJID M    unrelated
508         OBJID
509         :000000 100644 OBJID OBJID A    foo
510         :000000 100644 OBJID OBJID A    unrelated
511         EOF
512         test_cmp expect actual
513 '
514
515 test_expect_success '--continue asks for help after resolving patch to nil' '
516         pristine_detach conflicting &&
517         test_must_fail git cherry-pick initial..picked &&
518
519         test_cmp_rev unrelatedpick CHERRY_PICK_HEAD &&
520         git checkout HEAD -- unrelated &&
521         test_must_fail git cherry-pick --continue 2>msg &&
522         test_i18ngrep "The previous cherry-pick is now empty" msg
523 '
524
525 test_expect_success 'follow advice and skip nil patch' '
526         pristine_detach conflicting &&
527         test_must_fail git cherry-pick initial..picked &&
528
529         git checkout HEAD -- unrelated &&
530         test_must_fail git cherry-pick --continue &&
531         git reset &&
532         git cherry-pick --continue &&
533
534         git rev-list initial..HEAD >commits &&
535         test_line_count = 3 commits
536 '
537
538 test_expect_success '--continue respects opts' '
539         pristine_detach initial &&
540         test_expect_code 1 git cherry-pick -x base..anotherpick &&
541         echo "c" >foo &&
542         git add foo &&
543         git commit &&
544         git cherry-pick --continue &&
545         test_path_is_missing .git/sequencer &&
546         git cat-file commit HEAD >anotherpick_msg &&
547         git cat-file commit HEAD~1 >picked_msg &&
548         git cat-file commit HEAD~2 >unrelatedpick_msg &&
549         git cat-file commit HEAD~3 >initial_msg &&
550         ! grep "cherry picked from" initial_msg &&
551         grep "cherry picked from" unrelatedpick_msg &&
552         grep "cherry picked from" picked_msg &&
553         grep "cherry picked from" anotherpick_msg
554 '
555
556 test_expect_success '--continue of single-pick respects -x' '
557         pristine_detach initial &&
558         test_must_fail git cherry-pick -x picked &&
559         echo c >foo &&
560         git add foo &&
561         git cherry-pick --continue &&
562         test_path_is_missing .git/sequencer &&
563         git cat-file commit HEAD >msg &&
564         grep "cherry picked from" msg
565 '
566
567 test_expect_success '--continue respects -x in first commit in multi-pick' '
568         pristine_detach initial &&
569         test_must_fail git cherry-pick -x picked anotherpick &&
570         echo c >foo &&
571         git add foo &&
572         git cherry-pick --continue &&
573         test_path_is_missing .git/sequencer &&
574         git cat-file commit HEAD^ >msg &&
575         picked=$(git rev-parse --verify picked) &&
576         grep "cherry picked from.*$picked" msg
577 '
578
579 test_expect_failure '--signoff is automatically propagated to resolved conflict' '
580         pristine_detach initial &&
581         test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
582         echo "c" >foo &&
583         git add foo &&
584         git commit &&
585         git cherry-pick --continue &&
586         test_path_is_missing .git/sequencer &&
587         git cat-file commit HEAD >anotherpick_msg &&
588         git cat-file commit HEAD~1 >picked_msg &&
589         git cat-file commit HEAD~2 >unrelatedpick_msg &&
590         git cat-file commit HEAD~3 >initial_msg &&
591         ! grep "Signed-off-by:" initial_msg &&
592         grep "Signed-off-by:" unrelatedpick_msg &&
593         ! grep "Signed-off-by:" picked_msg &&
594         grep "Signed-off-by:" anotherpick_msg
595 '
596
597 test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
598         pristine_detach initial &&
599         test_must_fail git cherry-pick -s picked anotherpick &&
600         echo c >foo &&
601         git add foo &&
602         git cherry-pick --continue &&
603
604         git diff --exit-code HEAD &&
605         test_cmp_rev initial HEAD^^ &&
606         git cat-file commit HEAD^ >msg &&
607         ! grep Signed-off-by: msg
608 '
609
610 test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
611         pristine_detach initial &&
612         test_must_fail git cherry-pick -s picked &&
613         echo c >foo &&
614         git add foo &&
615         git cherry-pick --continue &&
616
617         git diff --exit-code HEAD &&
618         test_cmp_rev initial HEAD^ &&
619         git cat-file commit HEAD >msg &&
620         ! grep Signed-off-by: msg
621 '
622
623 test_expect_success 'malformed instruction sheet 1' '
624         pristine_detach initial &&
625         test_expect_code 1 git cherry-pick base..anotherpick &&
626         echo "resolved" >foo &&
627         git add foo &&
628         git commit &&
629         sed "s/pick /pick/" .git/sequencer/todo >new_sheet &&
630         cp new_sheet .git/sequencer/todo &&
631         test_expect_code 128 git cherry-pick --continue
632 '
633
634 test_expect_success 'malformed instruction sheet 2' '
635         pristine_detach initial &&
636         test_expect_code 1 git cherry-pick base..anotherpick &&
637         echo "resolved" >foo &&
638         git add foo &&
639         git commit &&
640         sed "s/pick/revert/" .git/sequencer/todo >new_sheet &&
641         cp new_sheet .git/sequencer/todo &&
642         test_expect_code 128 git cherry-pick --continue
643 '
644
645 test_expect_success 'empty commit set (no commits to walk)' '
646         pristine_detach initial &&
647         test_expect_code 128 git cherry-pick base..base
648 '
649
650 test_expect_success 'empty commit set (culled during walk)' '
651         pristine_detach initial &&
652         test_expect_code 128 git cherry-pick -2 --author=no.such.author base
653 '
654
655 test_expect_success 'malformed instruction sheet 3' '
656         pristine_detach initial &&
657         test_expect_code 1 git cherry-pick base..anotherpick &&
658         echo "resolved" >foo &&
659         git add foo &&
660         git commit &&
661         sed "s/pick \([0-9a-f]*\)/pick $_r10/" .git/sequencer/todo >new_sheet &&
662         cp new_sheet .git/sequencer/todo &&
663         test_expect_code 128 git cherry-pick --continue
664 '
665
666 test_expect_success 'instruction sheet, fat-fingers version' '
667         pristine_detach initial &&
668         test_expect_code 1 git cherry-pick base..anotherpick &&
669         echo "c" >foo &&
670         git add foo &&
671         git commit &&
672         sed "s/pick \([0-9a-f]*\)/pick   \1     /" .git/sequencer/todo >new_sheet &&
673         cp new_sheet .git/sequencer/todo &&
674         git cherry-pick --continue
675 '
676
677 test_expect_success 'commit descriptions in insn sheet are optional' '
678         pristine_detach initial &&
679         test_expect_code 1 git cherry-pick base..anotherpick &&
680         echo "c" >foo &&
681         git add foo &&
682         git commit &&
683         cut -d" " -f1,2 .git/sequencer/todo >new_sheet &&
684         cp new_sheet .git/sequencer/todo &&
685         git cherry-pick --continue &&
686         test_path_is_missing .git/sequencer &&
687         git rev-list HEAD >commits &&
688         test_line_count = 4 commits
689 '
690
691 test_done