]> git.ipfire.org Git - thirdparty/git.git/blame - t/t3510-cherry-pick-sequence.sh
tests: remove last uses of C_LOCALE_OUTPUT
[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 &&
5b7a64df
JS
126 test_must_fail git cherry-pick anotherpick 2>err &&
127 test_i18ngrep "git cherry-pick --skip" err &&
de81ca3f
RA
128 git cherry-pick --skip &&
129 test_cmp_rev dummy HEAD
130'
131
132test_expect_success 'skip a commit and check if rest of sequence is correct' '
133 pristine_detach initial &&
134 echo e >expect &&
135 cat >expect.log <<-EOF &&
136 OBJID
137 :100644 100644 OBJID OBJID M foo
138 OBJID
139 :100644 100644 OBJID OBJID M foo
140 OBJID
141 :100644 100644 OBJID OBJID M unrelated
142 OBJID
143 :000000 100644 OBJID OBJID A foo
144 :000000 100644 OBJID OBJID A unrelated
145 EOF
146 test_must_fail git cherry-pick base..yetanotherpick &&
147 test_must_fail git cherry-pick --skip &&
148 echo d >foo &&
149 git add foo &&
150 git cherry-pick --continue &&
151 {
152 git rev-list HEAD |
153 git diff-tree --root --stdin |
154 sed "s/$OID_REGEX/OBJID/g"
155 } >actual.log &&
156 test_cmp expect foo &&
157 test_cmp expect.log actual.log
158'
159
160test_expect_success 'check advice when we move HEAD by committing' '
161 pristine_detach initial &&
162 cat >expect <<-EOF &&
163 error: there is nothing to skip
164 hint: have you committed already?
165 hint: try "git cherry-pick --continue"
166 fatal: cherry-pick failed
167 EOF
168 test_must_fail git cherry-pick base..yetanotherpick &&
169 echo c >foo &&
170 git commit -a &&
171 test_path_is_missing .git/CHERRY_PICK_HEAD &&
172 test_must_fail git cherry-pick --skip 2>advice &&
173 test_i18ncmp expect advice
174'
175
dcb500dc
RA
176test_expect_success 'selectively advise --skip while launching another sequence' '
177 pristine_detach initial &&
178 cat >expect <<-EOF &&
179 error: cherry-pick is already in progress
180 hint: try "git cherry-pick (--continue | --skip | --abort | --quit)"
181 fatal: cherry-pick failed
182 EOF
183 test_must_fail git cherry-pick picked..yetanotherpick &&
184 test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
185 test_i18ncmp expect advice &&
186 cat >expect <<-EOF &&
187 error: cherry-pick is already in progress
188 hint: try "git cherry-pick (--continue | --abort | --quit)"
189 fatal: cherry-pick failed
190 EOF
191 git reset --merge &&
192 test_must_fail git cherry-pick picked..yetanotherpick 2>advice &&
193 test_i18ncmp expect advice
194'
195
de81ca3f
RA
196test_expect_success 'allow skipping commit but not abort for a new history' '
197 pristine_detach initial &&
198 cat >expect <<-EOF &&
199 error: cannot abort from a branch yet to be born
200 fatal: cherry-pick failed
201 EOF
202 git checkout --orphan new_disconnected &&
203 git reset --hard &&
204 test_must_fail git cherry-pick anotherpick &&
205 test_must_fail git cherry-pick --abort 2>advice &&
206 git cherry-pick --skip &&
207 test_i18ncmp expect advice
208'
209
210test_expect_success 'allow skipping stopped cherry-pick because of untracked file modifications' '
211 pristine_detach initial &&
212 git rm --cached unrelated &&
213 git commit -m "untrack unrelated" &&
214 test_must_fail git cherry-pick initial base &&
215 test_path_is_missing .git/CHERRY_PICK_HEAD &&
216 git cherry-pick --skip
217'
218
f80a8726 219test_expect_success '--quit does not complain when no cherry-pick is in progress' '
26ae337b 220 pristine_detach initial &&
f80a8726 221 git cherry-pick --quit
26ae337b
RR
222'
223
539047c1
JN
224test_expect_success '--abort requires cherry-pick in progress' '
225 pristine_detach initial &&
226 test_must_fail git cherry-pick --abort
227'
228
f80a8726 229test_expect_success '--quit cleans up sequencer state' '
26ae337b 230 pristine_detach initial &&
c6b7c7f3 231 test_expect_code 1 git cherry-pick base..picked &&
f80a8726 232 git cherry-pick --quit &&
3e7dd992
NTND
233 test_path_is_missing .git/sequencer &&
234 test_path_is_missing .git/CHERRY_PICK_HEAD
26ae337b
RR
235'
236
c427b211 237test_expect_success '--quit keeps HEAD and conflicted index intact' '
f80a8726
JN
238 pristine_detach initial &&
239 cat >expect <<-\EOF &&
240 OBJID
241 :100644 100644 OBJID OBJID M unrelated
242 OBJID
243 :000000 100644 OBJID OBJID A foo
244 :000000 100644 OBJID OBJID A unrelated
245 EOF
c6b7c7f3 246 test_expect_code 1 git cherry-pick base..picked &&
c427b211 247 git cherry-pick --quit &&
f80a8726
JN
248 test_path_is_missing .git/sequencer &&
249 test_must_fail git update-index --refresh &&
250 {
251 git rev-list HEAD |
252 git diff-tree --root --stdin |
2ece6ad2 253 sed "s/$OID_REGEX/OBJID/g"
f80a8726
JN
254 } >actual &&
255 test_cmp expect actual
256'
257
539047c1
JN
258test_expect_success '--abort to cancel multiple cherry-pick' '
259 pristine_detach initial &&
c6b7c7f3 260 test_expect_code 1 git cherry-pick base..anotherpick &&
539047c1
JN
261 git cherry-pick --abort &&
262 test_path_is_missing .git/sequencer &&
3e7dd992 263 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
264 test_cmp_rev initial HEAD &&
265 git update-index --refresh &&
266 git diff-index --exit-code HEAD
267'
268
269test_expect_success '--abort to cancel single cherry-pick' '
270 pristine_detach initial &&
c6b7c7f3 271 test_expect_code 1 git cherry-pick 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 initial HEAD &&
276 git update-index --refresh &&
277 git diff-index --exit-code HEAD
278'
279
1e41229d 280test_expect_success '--abort does not unsafely change HEAD' '
aeebd98e
SB
281 pristine_detach initial &&
282 test_must_fail git cherry-pick picked anotherpick &&
283 git reset --hard base &&
284 test_must_fail git cherry-pick picked anotherpick &&
285 git cherry-pick --abort 2>actual &&
286 test_i18ngrep "You seem to have moved HEAD" actual &&
287 test_cmp_rev base HEAD
288'
289
539047c1
JN
290test_expect_success 'cherry-pick --abort to cancel multiple revert' '
291 pristine_detach anotherpick &&
c6b7c7f3 292 test_expect_code 1 git revert base..picked &&
539047c1
JN
293 git cherry-pick --abort &&
294 test_path_is_missing .git/sequencer &&
3e7dd992 295 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
296 test_cmp_rev anotherpick HEAD &&
297 git update-index --refresh &&
298 git diff-index --exit-code HEAD
299'
300
301test_expect_success 'revert --abort works, too' '
302 pristine_detach anotherpick &&
c6b7c7f3 303 test_expect_code 1 git revert base..picked &&
539047c1
JN
304 git revert --abort &&
305 test_path_is_missing .git/sequencer &&
306 test_cmp_rev anotherpick HEAD
307'
308
309test_expect_success '--abort to cancel single revert' '
310 pristine_detach anotherpick &&
c6b7c7f3 311 test_expect_code 1 git revert picked &&
539047c1
JN
312 git revert --abort &&
313 test_path_is_missing .git/sequencer &&
314 test_cmp_rev anotherpick HEAD &&
315 git update-index --refresh &&
316 git diff-index --exit-code HEAD
317'
318
319test_expect_success '--abort keeps unrelated change, easy case' '
320 pristine_detach unrelatedpick &&
321 echo changed >expect &&
c6b7c7f3 322 test_expect_code 1 git cherry-pick picked..yetanotherpick &&
539047c1
JN
323 echo changed >unrelated &&
324 git cherry-pick --abort &&
325 test_cmp expect unrelated
326'
327
328test_expect_success '--abort refuses to clobber unrelated change, harder case' '
329 pristine_detach initial &&
330 echo changed >expect &&
c6b7c7f3 331 test_expect_code 1 git cherry-pick base..anotherpick &&
539047c1
JN
332 echo changed >unrelated &&
333 test_must_fail git cherry-pick --abort &&
334 test_cmp expect unrelated &&
335 git rev-list HEAD >log &&
336 test_line_count = 2 log &&
337 test_must_fail git update-index --refresh &&
338
339 git checkout unrelated &&
340 git cherry-pick --abort &&
341 test_cmp_rev initial HEAD
342'
343
218b65fb 344test_expect_success 'cherry-pick still writes sequencer state when one commit is left' '
2d27daa9 345 pristine_detach initial &&
c6b7c7f3 346 test_expect_code 1 git cherry-pick base..picked &&
218b65fb 347 test_path_is_dir .git/sequencer &&
2d27daa9
RR
348 echo "resolved" >foo &&
349 git add foo &&
350 git commit &&
351 {
352 git rev-list HEAD |
353 git diff-tree --root --stdin |
2ece6ad2 354 sed "s/$OID_REGEX/OBJID/g"
2d27daa9
RR
355 } >actual &&
356 cat >expect <<-\EOF &&
357 OBJID
358 :100644 100644 OBJID OBJID M foo
359 OBJID
360 :100644 100644 OBJID OBJID M unrelated
361 OBJID
362 :000000 100644 OBJID OBJID A foo
363 :000000 100644 OBJID OBJID A unrelated
364 EOF
365 test_cmp expect actual
366'
367
218b65fb 368test_expect_success '--abort after last commit in sequence' '
539047c1 369 pristine_detach initial &&
c6b7c7f3 370 test_expect_code 1 git cherry-pick base..picked &&
539047c1
JN
371 git cherry-pick --abort &&
372 test_path_is_missing .git/sequencer &&
3e7dd992 373 test_path_is_missing .git/CHERRY_PICK_HEAD &&
539047c1
JN
374 test_cmp_rev initial HEAD &&
375 git update-index --refresh &&
376 git diff-index --exit-code HEAD
377'
378
21afd080
RR
379test_expect_success 'cherry-pick does not implicitly stomp an existing operation' '
380 pristine_detach initial &&
c6b7c7f3 381 test_expect_code 1 git cherry-pick base..anotherpick &&
deb9845a 382 test-tool chmtime --get .git/sequencer >expect &&
c6b7c7f3 383 test_expect_code 128 git cherry-pick unrelatedpick &&
deb9845a 384 test-tool chmtime --get .git/sequencer >actual &&
21afd080
RR
385 test_cmp expect actual
386'
387
5a5d80f4
RR
388test_expect_success '--continue complains when no cherry-pick is in progress' '
389 pristine_detach initial &&
c6b7c7f3 390 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
391'
392
393test_expect_success '--continue complains when there are unresolved conflicts' '
394 pristine_detach initial &&
c6b7c7f3
RR
395 test_expect_code 1 git cherry-pick base..anotherpick &&
396 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
397'
398
093a3091
JN
399test_expect_success '--continue of single cherry-pick' '
400 pristine_detach initial &&
401 echo c >expect &&
402 test_must_fail git cherry-pick picked &&
403 echo c >foo &&
404 git add foo &&
405 git cherry-pick --continue &&
406
407 test_cmp expect foo &&
408 test_cmp_rev initial HEAD^ &&
409 git diff --exit-code HEAD &&
410 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD
411'
412
413test_expect_success '--continue of single revert' '
414 pristine_detach initial &&
415 echo resolved >expect &&
416 echo "Revert \"picked\"" >expect.msg &&
417 test_must_fail git revert picked &&
418 echo resolved >foo &&
419 git add foo &&
420 git cherry-pick --continue &&
421
422 git diff --exit-code HEAD &&
423 test_cmp expect foo &&
424 test_cmp_rev initial HEAD^ &&
425 git diff-tree -s --pretty=tformat:%s HEAD >msg &&
426 test_cmp expect.msg msg &&
427 test_must_fail git rev-parse --verify CHERRY_PICK_HEAD &&
428 test_must_fail git rev-parse --verify REVERT_HEAD
429'
430
431test_expect_success '--continue after resolving conflicts' '
432 pristine_detach initial &&
433 echo d >expect &&
434 cat >expect.log <<-\EOF &&
435 OBJID
436 :100644 100644 OBJID OBJID M foo
437 OBJID
438 :100644 100644 OBJID OBJID M foo
439 OBJID
440 :100644 100644 OBJID OBJID M unrelated
441 OBJID
442 :000000 100644 OBJID OBJID A foo
443 :000000 100644 OBJID OBJID A unrelated
444 EOF
445 test_must_fail git cherry-pick base..anotherpick &&
446 echo c >foo &&
447 git add foo &&
448 git cherry-pick --continue &&
449 {
450 git rev-list HEAD |
451 git diff-tree --root --stdin |
2ece6ad2 452 sed "s/$OID_REGEX/OBJID/g"
093a3091
JN
453 } >actual.log &&
454 test_cmp expect foo &&
455 test_cmp expect.log actual.log
456'
457
458test_expect_success '--continue after resolving conflicts and committing' '
5a5d80f4 459 pristine_detach initial &&
c6b7c7f3 460 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
461 echo "c" >foo &&
462 git add foo &&
463 git commit &&
464 git cherry-pick --continue &&
465 test_path_is_missing .git/sequencer &&
466 {
467 git rev-list HEAD |
468 git diff-tree --root --stdin |
2ece6ad2 469 sed "s/$OID_REGEX/OBJID/g"
5a5d80f4
RR
470 } >actual &&
471 cat >expect <<-\EOF &&
472 OBJID
473 :100644 100644 OBJID OBJID M foo
474 OBJID
475 :100644 100644 OBJID OBJID M foo
476 OBJID
477 :100644 100644 OBJID OBJID M unrelated
478 OBJID
479 :000000 100644 OBJID OBJID A foo
480 :000000 100644 OBJID OBJID A unrelated
481 EOF
482 test_cmp expect actual
483'
484
093a3091
JN
485test_expect_success '--continue asks for help after resolving patch to nil' '
486 pristine_detach conflicting &&
487 test_must_fail git cherry-pick initial..picked &&
488
489 test_cmp_rev unrelatedpick CHERRY_PICK_HEAD &&
490 git checkout HEAD -- unrelated &&
491 test_must_fail git cherry-pick --continue 2>msg &&
492 test_i18ngrep "The previous cherry-pick is now empty" msg
493'
494
a7eff1e0 495test_expect_success 'follow advice and skip nil patch' '
093a3091
JN
496 pristine_detach conflicting &&
497 test_must_fail git cherry-pick initial..picked &&
498
499 git checkout HEAD -- unrelated &&
500 test_must_fail git cherry-pick --continue &&
501 git reset &&
502 git cherry-pick --continue &&
503
504 git rev-list initial..HEAD >commits &&
505 test_line_count = 3 commits
506'
507
5a5d80f4
RR
508test_expect_success '--continue respects opts' '
509 pristine_detach initial &&
c6b7c7f3 510 test_expect_code 1 git cherry-pick -x base..anotherpick &&
5a5d80f4
RR
511 echo "c" >foo &&
512 git add foo &&
513 git commit &&
514 git cherry-pick --continue &&
515 test_path_is_missing .git/sequencer &&
516 git cat-file commit HEAD >anotherpick_msg &&
517 git cat-file commit HEAD~1 >picked_msg &&
518 git cat-file commit HEAD~2 >unrelatedpick_msg &&
519 git cat-file commit HEAD~3 >initial_msg &&
c7cf9566 520 ! grep "cherry picked from" initial_msg &&
5a5d80f4
RR
521 grep "cherry picked from" unrelatedpick_msg &&
522 grep "cherry picked from" picked_msg &&
523 grep "cherry picked from" anotherpick_msg
524'
525
093a3091
JN
526test_expect_success '--continue of single-pick respects -x' '
527 pristine_detach initial &&
528 test_must_fail git cherry-pick -x picked &&
529 echo c >foo &&
530 git add foo &&
531 git cherry-pick --continue &&
532 test_path_is_missing .git/sequencer &&
533 git cat-file commit HEAD >msg &&
534 grep "cherry picked from" msg
535'
536
537test_expect_success '--continue respects -x in first commit in multi-pick' '
538 pristine_detach initial &&
539 test_must_fail git cherry-pick -x picked anotherpick &&
540 echo c >foo &&
541 git add foo &&
542 git cherry-pick --continue &&
543 test_path_is_missing .git/sequencer &&
544 git cat-file commit HEAD^ >msg &&
545 picked=$(git rev-parse --verify picked) &&
546 grep "cherry picked from.*$picked" msg
547'
548
5ed75e2a 549test_expect_failure '--signoff is automatically propagated to resolved conflict' '
5a5d80f4 550 pristine_detach initial &&
c6b7c7f3 551 test_expect_code 1 git cherry-pick --signoff base..anotherpick &&
5a5d80f4
RR
552 echo "c" >foo &&
553 git add foo &&
554 git commit &&
555 git cherry-pick --continue &&
556 test_path_is_missing .git/sequencer &&
557 git cat-file commit HEAD >anotherpick_msg &&
558 git cat-file commit HEAD~1 >picked_msg &&
559 git cat-file commit HEAD~2 >unrelatedpick_msg &&
560 git cat-file commit HEAD~3 >initial_msg &&
c7cf9566 561 ! grep "Signed-off-by:" initial_msg &&
5a5d80f4 562 grep "Signed-off-by:" unrelatedpick_msg &&
c7cf9566 563 ! grep "Signed-off-by:" picked_msg &&
5a5d80f4
RR
564 grep "Signed-off-by:" anotherpick_msg
565'
566
5ed75e2a 567test_expect_failure '--signoff dropped for implicit commit of resolution, multi-pick case' '
093a3091
JN
568 pristine_detach initial &&
569 test_must_fail git cherry-pick -s picked anotherpick &&
570 echo c >foo &&
571 git add foo &&
572 git cherry-pick --continue &&
573
574 git diff --exit-code HEAD &&
575 test_cmp_rev initial HEAD^^ &&
576 git cat-file commit HEAD^ >msg &&
577 ! grep Signed-off-by: msg
578'
579
5ed75e2a 580test_expect_failure 'sign-off needs to be reaffirmed after conflict resolution, single-pick case' '
093a3091
JN
581 pristine_detach initial &&
582 test_must_fail git cherry-pick -s picked &&
583 echo c >foo &&
584 git add foo &&
585 git cherry-pick --continue &&
586
587 git diff --exit-code HEAD &&
588 test_cmp_rev initial HEAD^ &&
589 git cat-file commit HEAD >msg &&
590 ! grep Signed-off-by: msg
591'
592
5a5d80f4
RR
593test_expect_success 'malformed instruction sheet 1' '
594 pristine_detach initial &&
c6b7c7f3 595 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
596 echo "resolved" >foo &&
597 git add foo &&
598 git commit &&
599 sed "s/pick /pick/" .git/sequencer/todo >new_sheet &&
600 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 601 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
602'
603
604test_expect_success 'malformed instruction sheet 2' '
605 pristine_detach initial &&
c6b7c7f3 606 test_expect_code 1 git cherry-pick base..anotherpick &&
5a5d80f4
RR
607 echo "resolved" >foo &&
608 git add foo &&
609 git commit &&
610 sed "s/pick/revert/" .git/sequencer/todo >new_sheet &&
611 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 612 test_expect_code 128 git cherry-pick --continue
5a5d80f4
RR
613'
614
8530c739 615test_expect_success 'empty commit set (no commits to walk)' '
7f13334e
JN
616 pristine_detach initial &&
617 test_expect_code 128 git cherry-pick base..base
618'
619
8530c739
JK
620test_expect_success 'empty commit set (culled during walk)' '
621 pristine_detach initial &&
622 test_expect_code 128 git cherry-pick -2 --author=no.such.author base
623'
624
6bc1a235
RR
625test_expect_success 'malformed instruction sheet 3' '
626 pristine_detach initial &&
c6b7c7f3 627 test_expect_code 1 git cherry-pick base..anotherpick &&
6bc1a235
RR
628 echo "resolved" >foo &&
629 git add foo &&
630 git commit &&
631 sed "s/pick \([0-9a-f]*\)/pick $_r10/" .git/sequencer/todo >new_sheet &&
632 cp new_sheet .git/sequencer/todo &&
c6b7c7f3 633 test_expect_code 128 git cherry-pick --continue
6bc1a235
RR
634'
635
0db76962
RR
636test_expect_success 'instruction sheet, fat-fingers version' '
637 pristine_detach initial &&
c6b7c7f3 638 test_expect_code 1 git cherry-pick base..anotherpick &&
0db76962
RR
639 echo "c" >foo &&
640 git add foo &&
641 git commit &&
642 sed "s/pick \([0-9a-f]*\)/pick \1 /" .git/sequencer/todo >new_sheet &&
643 cp new_sheet .git/sequencer/todo &&
644 git cherry-pick --continue
645'
646
6bc1a235
RR
647test_expect_success 'commit descriptions in insn sheet are optional' '
648 pristine_detach initial &&
c6b7c7f3 649 test_expect_code 1 git cherry-pick base..anotherpick &&
6bc1a235
RR
650 echo "c" >foo &&
651 git add foo &&
652 git commit &&
653 cut -d" " -f1,2 .git/sequencer/todo >new_sheet &&
654 cp new_sheet .git/sequencer/todo &&
655 git cherry-pick --continue &&
656 test_path_is_missing .git/sequencer &&
657 git rev-list HEAD >commits &&
658 test_line_count = 4 commits
659'
660
04d3d3cf 661test_done