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