The 20th batch
[git.git] / t / t3510-cherry-pick-sequence.sh
blob93c725bac3cb3edd9fdaab7f0ecf9985fd7f848e
1 #!/bin/sh
3 test_description='Test cherry-pick continuation features
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
15 TEST_PASSES_SANITIZE_LEAK=true
16 . ./test-lib.sh
18 # Repeat first match 10 times
19 _r10='\1\1\1\1\1\1\1\1\1\1'
21 pristine_detach () {
22 git cherry-pick --quit &&
23 git checkout -f "$1^0" &&
24 git read-tree -u --reset HEAD &&
25 git clean -d -f -f -q -x
28 test_expect_success setup '
29 git config advice.detachedhead false &&
30 echo unrelated >unrelated &&
31 git add unrelated &&
32 test_commit initial foo a &&
33 test_commit base foo b &&
34 test_commit unrelatedpick unrelated reallyunrelated &&
35 test_commit picked foo c &&
36 test_commit anotherpick foo d &&
37 test_commit yetanotherpick foo e &&
38 pristine_detach initial &&
39 test_commit conflicting unrelated
42 test_expect_success 'cherry-pick persists data on failure' '
43 pristine_detach initial &&
44 test_expect_code 1 git cherry-pick -s base..anotherpick &&
45 test_path_is_dir .git/sequencer &&
46 test_path_is_file .git/sequencer/head &&
47 test_path_is_file .git/sequencer/todo &&
48 test_path_is_file .git/sequencer/opts
51 test_expect_success 'cherry-pick mid-cherry-pick-sequence' '
52 pristine_detach initial &&
53 test_must_fail git cherry-pick base..anotherpick &&
54 test_cmp_rev picked CHERRY_PICK_HEAD &&
55 # "oops, I forgot that these patches rely on the change from base"
56 git checkout HEAD foo &&
57 git cherry-pick base &&
58 git cherry-pick picked &&
59 git cherry-pick --continue &&
60 git diff --exit-code anotherpick
63 test_expect_success 'cherry-pick persists opts correctly' '
64 pristine_detach initial &&
65 # to make sure that the session to cherry-pick a sequence
66 # gets interrupted, use a high-enough number that is larger
67 # than the number of parents of any commit we have created
68 mainline=4 &&
69 test_expect_code 128 git cherry-pick -s -m $mainline --strategy=recursive -X patience -X ours --edit initial..anotherpick &&
70 test_path_is_dir .git/sequencer &&
71 test_path_is_file .git/sequencer/head &&
72 test_path_is_file .git/sequencer/todo &&
73 test_path_is_file .git/sequencer/opts &&
74 echo "true" >expect &&
75 git config --file=.git/sequencer/opts --get-all options.signoff >actual &&
76 test_cmp expect actual &&
77 echo "$mainline" >expect &&
78 git config --file=.git/sequencer/opts --get-all options.mainline >actual &&
79 test_cmp expect actual &&
80 echo "recursive" >expect &&
81 git config --file=.git/sequencer/opts --get-all options.strategy >actual &&
82 test_cmp expect actual &&
83 cat >expect <<-\EOF &&
84 patience
85 ours
86 EOF
87 git config --file=.git/sequencer/opts --get-all options.strategy-option >actual &&
88 test_cmp expect actual &&
89 echo "true" >expect &&
90 git config --file=.git/sequencer/opts --get-all options.edit >actual &&
91 test_cmp expect actual
94 test_expect_success 'cherry-pick persists --empty=stop correctly' '
95 pristine_detach yetanotherpick &&
96 # Picking `anotherpick` forces a conflict so that we stop. That
97 # commit is then skipped, after which we pick `yetanotherpick`
98 # while already on `yetanotherpick` to cause an empty commit
99 test_must_fail git cherry-pick --empty=stop anotherpick yetanotherpick &&
100 test_must_fail git cherry-pick --skip 2>msg &&
101 test_grep "The previous cherry-pick is now empty" msg &&
102 rm msg &&
103 git cherry-pick --abort
106 test_expect_success 'cherry-pick persists --empty=drop correctly' '
107 pristine_detach yetanotherpick &&
108 # Picking `anotherpick` forces a conflict so that we stop. That
109 # commit is then skipped, after which we pick `yetanotherpick`
110 # while already on `yetanotherpick` to cause an empty commit
111 test_must_fail git cherry-pick --empty=drop anotherpick yetanotherpick &&
112 git cherry-pick --skip &&
113 test_cmp_rev yetanotherpick HEAD
116 test_expect_success 'cherry-pick persists --empty=keep correctly' '
117 pristine_detach yetanotherpick &&
118 # Picking `anotherpick` forces a conflict so that we stop. That
119 # commit is then skipped, after which we pick `yetanotherpick`
120 # while already on `yetanotherpick` to cause an empty commit
121 test_must_fail git cherry-pick --empty=keep anotherpick yetanotherpick &&
122 git cherry-pick --skip &&
123 test_cmp_rev yetanotherpick HEAD^
126 test_expect_success 'revert persists opts correctly' '
127 pristine_detach initial &&
128 # to make sure that the session to revert a sequence
129 # gets interrupted, revert commits that are not in the history
130 # of HEAD.
131 test_expect_code 1 git revert -s --strategy=recursive -X patience -X ours --no-edit picked yetanotherpick &&
132 test_path_is_dir .git/sequencer &&
133 test_path_is_file .git/sequencer/head &&
134 test_path_is_file .git/sequencer/todo &&
135 test_path_is_file .git/sequencer/opts &&
136 echo "true" >expect &&
137 git config --file=.git/sequencer/opts --get-all options.signoff >actual &&
138 test_cmp expect actual &&
139 echo "recursive" >expect &&
140 git config --file=.git/sequencer/opts --get-all options.strategy >actual &&
141 test_cmp expect actual &&
142 cat >expect <<-\EOF &&
143 patience
144 ours
146 git config --file=.git/sequencer/opts --get-all options.strategy-option >actual &&
147 test_cmp expect actual &&
148 echo "false" >expect &&
149 git config --file=.git/sequencer/opts --get-all options.edit >actual &&
150 test_cmp expect actual
153 test_expect_success 'cherry-pick cleans up sequencer state upon success' '
154 pristine_detach initial &&
155 git cherry-pick initial..picked &&
156 test_path_is_missing .git/sequencer
159 test_expect_success 'cherry-pick --skip requires cherry-pick in progress' '
160 pristine_detach initial &&
161 test_must_fail git cherry-pick --skip
164 test_expect_success 'revert --skip requires revert in progress' '
165 pristine_detach initial &&
166 test_must_fail git revert --skip
169 test_expect_success 'cherry-pick --skip to skip commit' '
170 pristine_detach initial &&
171 test_must_fail git cherry-pick anotherpick &&
172 test_must_fail git revert --skip &&
173 git cherry-pick --skip &&
174 test_cmp_rev initial HEAD &&
175 test_path_is_missing .git/CHERRY_PICK_HEAD
178 test_expect_success 'revert --skip to skip commit' '
179 pristine_detach anotherpick &&
180 test_must_fail git revert anotherpick~1 &&
181 test_must_fail git cherry-pick --skip &&
182 git revert --skip &&
183 test_cmp_rev anotherpick HEAD
186 test_expect_success 'skip "empty" commit' '
187 pristine_detach picked &&
188 test_commit dummy foo d &&
189 test_must_fail git cherry-pick anotherpick 2>err &&
190 test_grep "git cherry-pick --skip" err &&
191 git cherry-pick --skip &&
192 test_cmp_rev dummy HEAD
195 test_expect_success 'skip a commit and check if rest of sequence is correct' '
196 pristine_detach initial &&
197 echo e >expect &&
198 cat >expect.log <<-EOF &&
199 OBJID
200 :100644 100644 OBJID OBJID M foo
201 OBJID
202 :100644 100644 OBJID OBJID M foo
203 OBJID
204 :100644 100644 OBJID OBJID M unrelated
205 OBJID
206 :000000 100644 OBJID OBJID A foo
207 :000000 100644 OBJID OBJID A unrelated
209 test_must_fail git cherry-pick base..yetanotherpick &&
210 test_must_fail git cherry-pick --skip &&
211 echo d >foo &&
212 git add foo &&
213 git cherry-pick --continue &&
215 git rev-list HEAD |
216 git diff-tree --root --stdin |
217 sed "s/$OID_REGEX/OBJID/g"
218 } >actual.log &&
219 test_cmp expect foo &&
220 test_cmp expect.log actual.log
223 test_expect_success 'check advice when we move HEAD by committing' '
224 pristine_detach initial &&
225 cat >expect <<-EOF &&
226 error: there is nothing to skip
227 hint: have you committed already?
228 hint: try "git cherry-pick --continue"
229 fatal: cherry-pick failed
231 test_must_fail git cherry-pick base..yetanotherpick &&
232 echo c >foo &&
233 git commit -a &&
234 test_path_is_missing .git/CHERRY_PICK_HEAD &&
235 test_must_fail git cherry-pick --skip 2>advice &&
236 test_cmp expect advice
239 test_expect_success 'selectively advise --skip while launching another sequence' '
240 pristine_detach initial &&
241 cat >expect <<-EOF &&
242 error: cherry-pick is already in progress
243 hint: try "git cherry-pick (--continue | --skip | --abort | --quit)"
244 fatal: cherry-pick failed
246 test_must_fail git cherry-pick picked..yetanotherpick &&
247 test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
248 test_cmp expect advice &&
249 cat >expect <<-EOF &&
250 error: cherry-pick is already in progress
251 hint: try "git cherry-pick (--continue | --abort | --quit)"
252 fatal: cherry-pick failed
254 git reset --merge &&
255 test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
256 test_cmp expect advice
259 test_expect_success 'allow skipping commit but not abort for a new history' '
260 pristine_detach initial &&
261 cat >expect <<-EOF &&
262 error: cannot abort from a branch yet to be born
263 fatal: cherry-pick failed
265 git checkout --orphan new_disconnected &&
266 git reset --hard &&
267 test_must_fail git cherry-pick anotherpick &&
268 test_must_fail git cherry-pick --abort 2>advice &&
269 git cherry-pick --skip &&
270 test_cmp expect advice
273 test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
274 test_when_finished "rm unrelated" &&
275 pristine_detach initial &&
276 git rm --cached unrelated &&
277 git commit -m "untrack unrelated" &&
278 test_must_fail git cherry-pick initial base &&
279 test_path_is_missing .git/CHERRY_PICK_HEAD &&
280 git cherry-pick --skip
283 test_expect_success '--quit does not complain when no cherry-pick is in progress' '
284 pristine_detach initial &&
285 git cherry-pick --quit
288 test_expect_success '--abort requires cherry-pick in progress' '
289 pristine_detach initial &&
290 test_must_fail git cherry-pick --abort
293 test_expect_success '--quit cleans up sequencer state' '
294 pristine_detach initial &&
295 test_expect_code 1 git cherry-pick base..picked &&
296 git cherry-pick --quit &&
297 test_path_is_missing .git/sequencer &&
298 test_path_is_missing .git/CHERRY_PICK_HEAD
301 test_expect_success '--quit keeps HEAD and conflicted index intact' '
302 pristine_detach initial &&
303 cat >expect <<-\EOF &&
304 OBJID
305 :100644 100644 OBJID OBJID M unrelated
306 OBJID
307 :000000 100644 OBJID OBJID A foo
308 :000000 100644 OBJID OBJID A unrelated
310 test_expect_code 1 git cherry-pick base..picked &&
311 git cherry-pick --quit &&
312 test_path_is_missing .git/sequencer &&
313 test_must_fail git update-index --refresh &&
315 git rev-list HEAD |
316 git diff-tree --root --stdin |
317 sed "s/$OID_REGEX/OBJID/g"
318 } >actual &&
319 test_cmp expect actual
322 test_expect_success '--abort to cancel multiple cherry-pick' '
323 pristine_detach initial &&
324 test_expect_code 1 git cherry-pick base..anotherpick &&
325 git cherry-pick --abort &&
326 test_path_is_missing .git/sequencer &&
327 test_path_is_missing .git/CHERRY_PICK_HEAD &&
328 test_cmp_rev initial HEAD &&
329 git update-index --refresh &&
330 git diff-index --exit-code HEAD
333 test_expect_success '--abort to cancel single cherry-pick' '
334 pristine_detach initial &&
335 test_expect_code 1 git cherry-pick picked &&
336 git cherry-pick --abort &&
337 test_path_is_missing .git/sequencer &&
338 test_path_is_missing .git/CHERRY_PICK_HEAD &&
339 test_cmp_rev initial HEAD &&
340 git update-index --refresh &&
341 git diff-index --exit-code HEAD
344 test_expect_success '--abort does not unsafely change HEAD' '
345 pristine_detach initial &&
346 test_must_fail git cherry-pick picked anotherpick &&
347 git reset --hard base &&
348 test_must_fail git cherry-pick picked anotherpick &&
349 git cherry-pick --abort 2>actual &&
350 test_grep "You seem to have moved HEAD" actual &&
351 test_cmp_rev base HEAD
354 test_expect_success 'cherry-pick --abort to cancel multiple revert' '
355 pristine_detach anotherpick &&
356 test_expect_code 1 git revert base..picked &&
357 git cherry-pick --abort &&
358 test_path_is_missing .git/sequencer &&
359 test_path_is_missing .git/CHERRY_PICK_HEAD &&
360 test_cmp_rev anotherpick HEAD &&
361 git update-index --refresh &&
362 git diff-index --exit-code HEAD
365 test_expect_success 'revert --abort works, too' '
366 pristine_detach anotherpick &&
367 test_expect_code 1 git revert base..picked &&
368 git revert --abort &&
369 test_path_is_missing .git/sequencer &&
370 test_cmp_rev anotherpick HEAD
373 test_expect_success '--abort to cancel single revert' '
374 pristine_detach anotherpick &&
375 test_expect_code 1 git revert picked &&
376 git revert --abort &&
377 test_path_is_missing .git/sequencer &&
378 test_cmp_rev anotherpick HEAD &&
379 git update-index --refresh &&
380 git diff-index --exit-code HEAD
383 test_expect_success '--abort keeps unrelated change, easy case' '
384 pristine_detach unrelatedpick &&
385 echo changed >expect &&
386 test_expect_code 1 git cherry-pick picked..yetanotherpick &&
387 echo changed >unrelated &&
388 git cherry-pick --abort &&
389 test_cmp expect unrelated
392 test_expect_success '--abort refuses to clobber unrelated change, harder case' '
393 pristine_detach initial &&
394 echo changed >expect &&
395 test_expect_code 1 git cherry-pick base..anotherpick &&
396 echo changed >unrelated &&
397 test_must_fail git cherry-pick --abort &&
398 test_cmp expect unrelated &&
399 git rev-list HEAD >log &&
400 test_line_count = 2 log &&
401 test_must_fail git update-index --refresh &&
403 git checkout unrelated &&
404 git cherry-pick --abort &&
405 test_cmp_rev initial HEAD
408 test_expect_success 'cherry-pick still writes sequencer state when one commit is left' '
409 pristine_detach initial &&
410 test_expect_code 1 git cherry-pick base..picked &&
411 test_path_is_dir .git/sequencer &&
412 echo "resolved" >foo &&
413 git add foo &&
414 git commit &&
416 git rev-list HEAD |
417 git diff-tree --root --stdin |
418 sed "s/$OID_REGEX/OBJID/g"
419 } >actual &&
420 cat >expect <<-\EOF &&
421 OBJID
422 :100644 100644 OBJID OBJID M foo
423 OBJID
424 :100644 100644 OBJID OBJID M unrelated
425 OBJID
426 :000000 100644 OBJID OBJID A foo
427 :000000 100644 OBJID OBJID A unrelated
429 test_cmp expect actual
432 test_expect_success '--abort after last commit in sequence' '
433 pristine_detach initial &&
434 test_expect_code 1 git cherry-pick base..picked &&
435 git cherry-pick --abort &&
436 test_path_is_missing .git/sequencer &&
437 test_path_is_missing .git/CHERRY_PICK_HEAD &&
438 test_cmp_rev initial HEAD &&
439 git update-index --refresh &&
440 git diff-index --exit-code HEAD
443 test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
444 pristine_detach initial &&
445 test_expect_code 1 git cherry-pick base..anotherpick &&
446 test-tool chmtime --get .git/sequencer >expect &&
447 test_expect_code 128 git cherry-pick unrelatedpick &&
448 test-tool chmtime --get .git/sequencer >actual &&
449 test_cmp expect actual
452 test_expect_success '--continue complains when no cherry-pick is in progress' '
453 pristine_detach initial &&
454 test_expect_code 128 git cherry-pick --continue
457 test_expect_success '--continue complains when there are unresolved conflicts' '
458 pristine_detach initial &&
459 test_expect_code 1 git cherry-pick base..anotherpick &&
460 test_expect_code 128 git cherry-pick --continue
463 test_expect_success '--continue of single cherry-pick' '
464 pristine_detach initial &&
465 echo c >expect &&
466 test_must_fail git cherry-pick picked &&
467 echo c >foo &&
468 git add foo &&
469 git cherry-pick --continue &&
471 test_cmp expect foo &&
472 test_cmp_rev initial HEAD^ &&
473 git diff --exit-code HEAD &&
474 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
477 test_expect_success '--continue of single revert' '
478 pristine_detach initial &&
479 echo resolved >expect &&
480 echo "Revert \"picked\"" >expect.msg &&
481 test_must_fail git revert picked &&
482 echo resolved >foo &&
483 git add foo &&
484 git cherry-pick --continue &&
486 git diff --exit-code HEAD &&
487 test_cmp expect foo &&
488 test_cmp_rev initial HEAD^ &&
489 git diff-tree -s --pretty=tformat:%s HEAD >msg &&
490 test_cmp expect.msg msg &&
491 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
492 test_must_fail git rev-parse --verify REVERT_HEAD
495 test_expect_success '--continue after resolving conflicts' '
496 pristine_detach initial &&
497 echo d >expect &&
498 cat >expect.log <<-\EOF &&
499 OBJID
500 :100644 100644 OBJID OBJID M foo
501 OBJID
502 :100644 100644 OBJID OBJID M foo
503 OBJID
504 :100644 100644 OBJID OBJID M unrelated
505 OBJID
506 :000000 100644 OBJID OBJID A foo
507 :000000 100644 OBJID OBJID A unrelated
509 test_must_fail git cherry-pick base..anotherpick &&
510 echo c >foo &&
511 git add foo &&
512 git cherry-pick --continue &&
514 git rev-list HEAD |
515 git diff-tree --root --stdin |
516 sed "s/$OID_REGEX/OBJID/g"
517 } >actual.log &&
518 test_cmp expect foo &&
519 test_cmp expect.log actual.log
522 test_expect_success '--continue after resolving conflicts and committing' '
523 pristine_detach initial &&
524 test_expect_code 1 git cherry-pick base..anotherpick &&
525 echo "c" >foo &&
526 git add foo &&
527 git commit &&
528 git cherry-pick --continue &&
529 test_path_is_missing .git/sequencer &&
531 git rev-list HEAD |
532 git diff-tree --root --stdin |
533 sed "s/$OID_REGEX/OBJID/g"
534 } >actual &&
535 cat >expect <<-\EOF &&
536 OBJID
537 :100644 100644 OBJID OBJID M foo
538 OBJID
539 :100644 100644 OBJID OBJID M foo
540 OBJID
541 :100644 100644 OBJID OBJID M unrelated
542 OBJID
543 :000000 100644 OBJID OBJID A foo
544 :000000 100644 OBJID OBJID A unrelated
546 test_cmp expect actual
549 test_expect_success '--continue asks for help after resolving patch to nil' '
550 pristine_detach conflicting &&
551 test_must_fail git cherry-pick initial..picked &&
553 test_cmp_rev unrelatedpick CHERRY_PICK_HEAD &&
554 git checkout HEAD -- unrelated &&
555 test_must_fail git cherry-pick --continue 2>msg &&
556 test_grep "The previous cherry-pick is now empty" msg
559 test_expect_success 'follow advice and skip nil patch' '
560 pristine_detach conflicting &&
561 test_must_fail git cherry-pick initial..picked &&
563 git checkout HEAD -- unrelated &&
564 test_must_fail git cherry-pick --continue &&
565 git reset &&
566 git cherry-pick --continue &&
568 git rev-list initial..HEAD >commits &&
569 test_line_count = 3 commits
572 test_expect_success '--continue respects opts' '
573 pristine_detach initial &&
574 test_expect_code 1 git cherry-pick -x base..anotherpick &&
575 echo "c" >foo &&
576 git add foo &&
577 git commit &&
578 git cherry-pick --continue &&
579 test_path_is_missing .git/sequencer &&
580 git cat-file commit HEAD >anotherpick_msg &&
581 git cat-file commit HEAD~1 >picked_msg &&
582 git cat-file commit HEAD~2 >unrelatedpick_msg &&
583 git cat-file commit HEAD~3 >initial_msg &&
584 ! grep "cherry picked from" initial_msg &&
585 grep "cherry picked from" unrelatedpick_msg &&
586 grep "cherry picked from" picked_msg &&
587 grep "cherry picked from" anotherpick_msg
590 test_expect_success '--continue of single-pick respects -x' '
591 pristine_detach initial &&
592 test_must_fail git cherry-pick -x picked &&
593 echo c >foo &&
594 git add foo &&
595 git cherry-pick --continue &&
596 test_path_is_missing .git/sequencer &&
597 git cat-file commit HEAD >msg &&
598 grep "cherry picked from" msg
601 test_expect_success '--continue respects -x in first commit in multi-pick' '
602 pristine_detach initial &&
603 test_must_fail git cherry-pick -x picked anotherpick &&
604 echo c >foo &&
605 git add foo &&
606 git cherry-pick --continue &&
607 test_path_is_missing .git/sequencer &&
608 git cat-file commit HEAD^ >msg &&
609 picked=$(git rev-parse --verify picked) &&
610 grep "cherry picked from.*$picked" msg
613 test_expect_failure '--signoff is automatically propagated to resolved conflict' '
614 pristine_detach initial &&
615 test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
616 echo "c" >foo &&
617 git add foo &&
618 git commit &&
619 git cherry-pick --continue &&
620 test_path_is_missing .git/sequencer &&
621 git cat-file commit HEAD >anotherpick_msg &&
622 git cat-file commit HEAD~1 >picked_msg &&
623 git cat-file commit HEAD~2 >unrelatedpick_msg &&
624 git cat-file commit HEAD~3 >initial_msg &&
625 ! grep "Signed-off-by:" initial_msg &&
626 grep "Signed-off-by:" unrelatedpick_msg &&
627 ! grep "Signed-off-by:" picked_msg &&
628 grep "Signed-off-by:" anotherpick_msg
631 test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
632 pristine_detach initial &&
633 test_must_fail git cherry-pick -s picked anotherpick &&
634 echo c >foo &&
635 git add foo &&
636 git cherry-pick --continue &&
638 git diff --exit-code HEAD &&
639 test_cmp_rev initial HEAD^^ &&
640 git cat-file commit HEAD^ >msg &&
641 ! grep Signed-off-by: msg
644 test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
645 pristine_detach initial &&
646 test_must_fail git cherry-pick -s picked &&
647 echo c >foo &&
648 git add foo &&
649 git cherry-pick --continue &&
651 git diff --exit-code HEAD &&
652 test_cmp_rev initial HEAD^ &&
653 git cat-file commit HEAD >msg &&
654 ! grep Signed-off-by: msg
657 test_expect_success 'malformed instruction sheet 1' '
658 pristine_detach initial &&
659 test_expect_code 1 git cherry-pick base..anotherpick &&
660 echo "resolved" >foo &&
661 git add foo &&
662 git commit &&
663 sed "s/pick /pick/" .git/sequencer/todo >new_sheet &&
664 cp new_sheet .git/sequencer/todo &&
665 test_expect_code 128 git cherry-pick --continue
668 test_expect_success 'malformed instruction sheet 2' '
669 pristine_detach initial &&
670 test_expect_code 1 git cherry-pick base..anotherpick &&
671 echo "resolved" >foo &&
672 git add foo &&
673 git commit &&
674 sed "s/pick/revert/" .git/sequencer/todo >new_sheet &&
675 cp new_sheet .git/sequencer/todo &&
676 test_expect_code 128 git cherry-pick --continue
679 test_expect_success 'empty commit set (no commits to walk)' '
680 pristine_detach initial &&
681 test_expect_code 128 git cherry-pick base..base
684 test_expect_success 'empty commit set (culled during walk)' '
685 pristine_detach initial &&
686 test_expect_code 128 git cherry-pick -2 --author=no.such.author base
689 test_expect_success 'malformed instruction sheet 3' '
690 pristine_detach initial &&
691 test_expect_code 1 git cherry-pick base..anotherpick &&
692 echo "resolved" >foo &&
693 git add foo &&
694 git commit &&
695 sed "s/pick \([0-9a-f]*\)/pick $_r10/" .git/sequencer/todo >new_sheet &&
696 cp new_sheet .git/sequencer/todo &&
697 test_expect_code 128 git cherry-pick --continue
700 test_expect_success 'instruction sheet, fat-fingers version' '
701 pristine_detach initial &&
702 test_expect_code 1 git cherry-pick base..anotherpick &&
703 echo "c" >foo &&
704 git add foo &&
705 git commit &&
706 sed "s/pick \([0-9a-f]*\)/pick \1 /" .git/sequencer/todo >new_sheet &&
707 cp new_sheet .git/sequencer/todo &&
708 git cherry-pick --continue
711 test_expect_success 'commit descriptions in insn sheet are optional' '
712 pristine_detach initial &&
713 test_expect_code 1 git cherry-pick base..anotherpick &&
714 echo "c" >foo &&
715 git add foo &&
716 git commit &&
717 cut -d" " -f1,2 .git/sequencer/todo >new_sheet &&
718 cp new_sheet .git/sequencer/todo &&
719 git cherry-pick --continue &&
720 test_path_is_missing .git/sequencer &&
721 git rev-list HEAD >commits &&
722 test_line_count = 4 commits
725 test_done