t4150: am with pre-applypatch hook
[git/mingw.git] / t / t4150-am.sh
blob957c63c768f1757c72507ec2df9cc373bf342d06
1 #!/bin/sh
3 test_description='git am running'
5 . ./test-lib.sh
7 test_expect_success 'setup: messages' '
8 cat >msg <<-\EOF &&
9 second
11 Lorem ipsum dolor sit amet, consectetuer sadipscing elitr, sed diam nonumy
12 eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
13 voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita
14 kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem
15 ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
16 tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
17 vero eos et accusam et justo duo dolores et ea rebum.
19 EOF
20 qz_to_tab_space <<-\EOF >>msg &&
21 QDuis autem vel eum iriure dolor in hendrerit in vulputate velit
22 Qesse molestie consequat, vel illum dolore eu feugiat nulla facilisis
23 Qat vero eros et accumsan et iusto odio dignissim qui blandit
24 Qpraesent luptatum zzril delenit augue duis dolore te feugait nulla
25 Qfacilisi.
26 EOF
27 cat >>msg <<-\EOF &&
29 Lorem ipsum dolor sit amet,
30 consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut
31 laoreet dolore magna aliquam erat volutpat.
33 git
34 ---
35 +++
37 Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit
38 lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure
39 dolor in hendrerit in vulputate velit esse molestie consequat, vel illum
40 dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio
41 dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te
42 feugait nulla facilisi.
43 EOF
45 cat >failmail <<-\EOF &&
46 From foo@example.com Fri May 23 10:43:49 2008
47 From: foo@example.com
48 To: bar@example.com
49 Subject: Re: [RFC/PATCH] git-foo.sh
50 Date: Fri, 23 May 2008 05:23:42 +0200
52 Sometimes we have to find out that there'\''s nothing left.
54 EOF
56 cat >pine <<-\EOF &&
57 From MAILER-DAEMON Fri May 23 10:43:49 2008
58 Date: 23 May 2008 05:23:42 +0200
59 From: Mail System Internal Data <MAILER-DAEMON@example.com>
60 Subject: DON'\''T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
61 Message-ID: <foo-0001@example.com>
63 This text is part of the internal format of your mail folder, and is not
64 a real message. It is created automatically by the mail system software.
65 If deleted, important folder data will be lost, and it will be re-created
66 with the data reset to initial values.
68 EOF
70 signoff="Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
73 test_expect_success setup '
74 echo hello >file &&
75 git add file &&
76 test_tick &&
77 git commit -m first &&
78 git tag first &&
80 echo world >>file &&
81 git add file &&
82 test_tick &&
83 git commit -s -F msg &&
84 git tag second &&
86 git format-patch --stdout first >patch1 &&
88 echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
89 echo "X-Fake-Field: Line One" &&
90 echo "X-Fake-Field: Line Two" &&
91 echo "X-Fake-Field: Line Three" &&
92 git format-patch --stdout first | sed -e "1d"
93 } > patch1.eml &&
95 echo "X-Fake-Field: Line One" &&
96 echo "X-Fake-Field: Line Two" &&
97 echo "X-Fake-Field: Line Three" &&
98 git format-patch --stdout first | sed -e "1d"
99 } | append_cr >patch1-crlf.eml &&
101 printf "%255s\\n" ""
102 echo "X-Fake-Field: Line One" &&
103 echo "X-Fake-Field: Line Two" &&
104 echo "X-Fake-Field: Line Three" &&
105 git format-patch --stdout first | sed -e "1d"
106 } > patch1-ws.eml &&
108 sed -n -e "3,\$p" msg >file &&
109 git add file &&
110 test_tick &&
111 git commit -m third &&
113 git format-patch --stdout first >patch2 &&
115 git checkout -b lorem &&
116 sed -n -e "11,\$p" msg >file &&
117 head -n 9 msg >>file &&
118 test_tick &&
119 git commit -a -m "moved stuff" &&
121 echo goodbye >another &&
122 git add another &&
123 test_tick &&
124 git commit -m "added another file" &&
126 git format-patch --stdout master >lorem-move.patch &&
127 git format-patch --no-prefix --stdout master >lorem-zero.patch &&
129 git checkout -b rename &&
130 git mv file renamed &&
131 git commit -m "renamed a file" &&
133 git format-patch -M --stdout lorem >rename.patch &&
135 git reset --soft lorem^ &&
136 git commit -m "renamed a file and added another" &&
138 git format-patch -M --stdout lorem^ >rename-add.patch &&
140 # reset time
141 sane_unset test_tick &&
142 test_tick
145 test_expect_success 'am applies patch correctly' '
146 rm -fr .git/rebase-apply &&
147 git reset --hard &&
148 git checkout first &&
149 test_tick &&
150 git am <patch1 &&
151 test_path_is_missing .git/rebase-apply &&
152 git diff --exit-code second &&
153 test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
154 test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
157 test_expect_success 'am fails if index is dirty' '
158 test_when_finished "rm -f dirtyfile" &&
159 rm -fr .git/rebase-apply &&
160 git reset --hard &&
161 git checkout first &&
162 echo dirtyfile >dirtyfile &&
163 git add dirtyfile &&
164 test_must_fail git am patch1 &&
165 test_path_is_dir .git/rebase-apply &&
166 test_cmp_rev first HEAD
169 test_expect_success 'am applies patch e-mail not in a mbox' '
170 rm -fr .git/rebase-apply &&
171 git reset --hard &&
172 git checkout first &&
173 git am patch1.eml &&
174 test_path_is_missing .git/rebase-apply &&
175 git diff --exit-code second &&
176 test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
177 test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
180 test_expect_success 'am applies patch e-mail not in a mbox with CRLF' '
181 rm -fr .git/rebase-apply &&
182 git reset --hard &&
183 git checkout first &&
184 git am patch1-crlf.eml &&
185 test_path_is_missing .git/rebase-apply &&
186 git diff --exit-code second &&
187 test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
188 test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
191 test_expect_success 'am applies patch e-mail with preceding whitespace' '
192 rm -fr .git/rebase-apply &&
193 git reset --hard &&
194 git checkout first &&
195 git am patch1-ws.eml &&
196 test_path_is_missing .git/rebase-apply &&
197 git diff --exit-code second &&
198 test "$(git rev-parse second)" = "$(git rev-parse HEAD)" &&
199 test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
202 test_expect_success 'am with applypatch-msg hook' '
203 test_when_finished "rm -f .git/hooks/applypatch-msg" &&
204 rm -fr .git/rebase-apply &&
205 git reset --hard &&
206 git checkout first &&
207 mkdir -p .git/hooks &&
208 write_script .git/hooks/applypatch-msg <<-\EOF &&
209 cat "$1" >actual-msg &&
210 echo hook-message >"$1"
212 git am patch1 &&
213 test_path_is_missing .git/rebase-apply &&
214 git diff --exit-code second &&
215 echo hook-message >expected &&
216 git log -1 --format=format:%B >actual &&
217 test_cmp expected actual &&
218 git log -1 --format=format:%B second >expected &&
219 test_cmp expected actual-msg
222 test_expect_success 'am with failing applypatch-msg hook' '
223 test_when_finished "rm -f .git/hooks/applypatch-msg" &&
224 rm -fr .git/rebase-apply &&
225 git reset --hard &&
226 git checkout first &&
227 mkdir -p .git/hooks &&
228 write_script .git/hooks/applypatch-msg <<-\EOF &&
229 exit 1
231 test_must_fail git am patch1 &&
232 test_path_is_dir .git/rebase-apply &&
233 git diff --exit-code first &&
234 test_cmp_rev first HEAD
237 test_expect_success 'am with pre-applypatch hook' '
238 test_when_finished "rm -f .git/hooks/pre-applypatch" &&
239 rm -fr .git/rebase-apply &&
240 git reset --hard &&
241 git checkout first &&
242 mkdir -p .git/hooks &&
243 write_script .git/hooks/pre-applypatch <<-\EOF &&
244 git diff first >diff.actual
245 exit 0
247 git am patch1 &&
248 test_path_is_missing .git/rebase-apply &&
249 git diff --exit-code second &&
250 test_cmp_rev second HEAD &&
251 git diff first..second >diff.expected &&
252 test_cmp diff.expected diff.actual
255 test_expect_success 'am with failing pre-applypatch hook' '
256 test_when_finished "rm -f .git/hooks/pre-applypatch" &&
257 rm -fr .git/rebase-apply &&
258 git reset --hard &&
259 git checkout first &&
260 mkdir -p .git/hooks &&
261 write_script .git/hooks/pre-applypatch <<-\EOF &&
262 exit 1
264 test_must_fail git am patch1 &&
265 test_path_is_dir .git/rebase-apply &&
266 git diff --exit-code second &&
267 test_cmp_rev first HEAD
270 test_expect_success 'setup: new author and committer' '
271 GIT_AUTHOR_NAME="Another Thor" &&
272 GIT_AUTHOR_EMAIL="a.thor@example.com" &&
273 GIT_COMMITTER_NAME="Co M Miter" &&
274 GIT_COMMITTER_EMAIL="c.miter@example.com" &&
275 export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL
278 compare () {
279 a=$(git cat-file commit "$2" | grep "^$1 ") &&
280 b=$(git cat-file commit "$3" | grep "^$1 ") &&
281 test "$a" = "$b"
284 test_expect_success 'am changes committer and keeps author' '
285 test_tick &&
286 rm -fr .git/rebase-apply &&
287 git reset --hard &&
288 git checkout first &&
289 git am patch2 &&
290 test_path_is_missing .git/rebase-apply &&
291 test "$(git rev-parse master^^)" = "$(git rev-parse HEAD^^)" &&
292 git diff --exit-code master..HEAD &&
293 git diff --exit-code master^..HEAD^ &&
294 compare author master HEAD &&
295 compare author master^ HEAD^ &&
296 test "$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" = \
297 "$(git log -1 --pretty=format:"%cn <%ce>" HEAD)"
300 test_expect_success 'am --signoff adds Signed-off-by: line' '
301 rm -fr .git/rebase-apply &&
302 git reset --hard &&
303 git checkout -b master2 first &&
304 git am --signoff <patch2 &&
305 printf "%s\n" "$signoff" >expected &&
306 echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >>expected &&
307 git cat-file commit HEAD^ | grep "Signed-off-by:" >actual &&
308 test_cmp expected actual &&
309 echo "Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>" >expected &&
310 git cat-file commit HEAD | grep "Signed-off-by:" >actual &&
311 test_cmp expected actual
314 test_expect_success 'am stays in branch' '
315 echo refs/heads/master2 >expected &&
316 git symbolic-ref HEAD >actual &&
317 test_cmp expected actual
320 test_expect_success 'am --signoff does not add Signed-off-by: line if already there' '
321 git format-patch --stdout HEAD^ >patch3 &&
322 sed -e "/^Subject/ s,\[PATCH,Re: Re: Re: & 1/5 v2] [foo," patch3 >patch4 &&
323 rm -fr .git/rebase-apply &&
324 git reset --hard &&
325 git checkout HEAD^ &&
326 git am --signoff patch4 &&
327 git cat-file commit HEAD >actual &&
328 test $(grep -c "^Signed-off-by:" actual) -eq 1
331 test_expect_success 'am without --keep removes Re: and [PATCH] stuff' '
332 git rev-parse HEAD >expected &&
333 git rev-parse master2 >actual &&
334 test_cmp expected actual
337 test_expect_success 'am --keep really keeps the subject' '
338 rm -fr .git/rebase-apply &&
339 git reset --hard &&
340 git checkout HEAD^ &&
341 git am --keep patch4 &&
342 test_path_is_missing .git/rebase-apply &&
343 git cat-file commit HEAD >actual &&
344 grep "Re: Re: Re: \[PATCH 1/5 v2\] \[foo\] third" actual
347 test_expect_success 'am --keep-non-patch really keeps the non-patch part' '
348 rm -fr .git/rebase-apply &&
349 git reset --hard &&
350 git checkout HEAD^ &&
351 git am --keep-non-patch patch4 &&
352 test_path_is_missing .git/rebase-apply &&
353 git cat-file commit HEAD >actual &&
354 grep "^\[foo\] third" actual
357 test_expect_success 'setup am -3' '
358 rm -fr .git/rebase-apply &&
359 git reset --hard &&
360 git checkout -b base3way master2 &&
361 sed -n -e "3,\$p" msg >file &&
362 head -n 9 msg >>file &&
363 git add file &&
364 test_tick &&
365 git commit -m "copied stuff"
368 test_expect_success 'am -3 falls back to 3-way merge' '
369 rm -fr .git/rebase-apply &&
370 git reset --hard &&
371 git checkout -b lorem2 base3way &&
372 git am -3 lorem-move.patch &&
373 test_path_is_missing .git/rebase-apply &&
374 git diff --exit-code lorem
377 test_expect_success 'am -3 -p0 can read --no-prefix patch' '
378 rm -fr .git/rebase-apply &&
379 git reset --hard &&
380 git checkout -b lorem3 base3way &&
381 git am -3 -p0 lorem-zero.patch &&
382 test_path_is_missing .git/rebase-apply &&
383 git diff --exit-code lorem
386 test_expect_success 'am with config am.threeWay falls back to 3-way merge' '
387 rm -fr .git/rebase-apply &&
388 git reset --hard &&
389 git checkout -b lorem4 base3way &&
390 test_config am.threeWay 1 &&
391 git am lorem-move.patch &&
392 test_path_is_missing .git/rebase-apply &&
393 git diff --exit-code lorem
396 test_expect_success 'am with config am.threeWay overridden by --no-3way' '
397 rm -fr .git/rebase-apply &&
398 git reset --hard &&
399 git checkout -b lorem5 base3way &&
400 test_config am.threeWay 1 &&
401 test_must_fail git am --no-3way lorem-move.patch &&
402 test_path_is_dir .git/rebase-apply
405 test_expect_success 'am can rename a file' '
406 grep "^rename from" rename.patch &&
407 rm -fr .git/rebase-apply &&
408 git reset --hard &&
409 git checkout lorem^0 &&
410 git am rename.patch &&
411 test_path_is_missing .git/rebase-apply &&
412 git update-index --refresh &&
413 git diff --exit-code rename
416 test_expect_success 'am -3 can rename a file' '
417 grep "^rename from" rename.patch &&
418 rm -fr .git/rebase-apply &&
419 git reset --hard &&
420 git checkout lorem^0 &&
421 git am -3 rename.patch &&
422 test_path_is_missing .git/rebase-apply &&
423 git update-index --refresh &&
424 git diff --exit-code rename
427 test_expect_success 'am -3 can rename a file after falling back to 3-way merge' '
428 grep "^rename from" rename-add.patch &&
429 rm -fr .git/rebase-apply &&
430 git reset --hard &&
431 git checkout lorem^0 &&
432 git am -3 rename-add.patch &&
433 test_path_is_missing .git/rebase-apply &&
434 git update-index --refresh &&
435 git diff --exit-code rename
438 test_expect_success 'am -3 -q is quiet' '
439 rm -fr .git/rebase-apply &&
440 git checkout -f lorem2 &&
441 git reset base3way --hard &&
442 git am -3 -q lorem-move.patch >output.out 2>&1 &&
443 ! test -s output.out
446 test_expect_success 'am pauses on conflict' '
447 rm -fr .git/rebase-apply &&
448 git reset --hard &&
449 git checkout lorem2^^ &&
450 test_must_fail git am lorem-move.patch &&
451 test -d .git/rebase-apply
454 test_expect_success 'am --skip works' '
455 echo goodbye >expected &&
456 git am --skip &&
457 test_path_is_missing .git/rebase-apply &&
458 git diff --exit-code lorem2^^ -- file &&
459 test_cmp expected another
462 test_expect_success 'am --abort removes a stray directory' '
463 mkdir .git/rebase-apply &&
464 git am --abort &&
465 test_path_is_missing .git/rebase-apply
468 test_expect_success 'am refuses patches when paused' '
469 rm -fr .git/rebase-apply &&
470 git reset --hard &&
471 git checkout lorem2^^ &&
473 test_must_fail git am lorem-move.patch &&
474 test_path_is_dir .git/rebase-apply &&
475 test_cmp_rev lorem2^^ HEAD &&
477 test_must_fail git am <lorem-move.patch &&
478 test_path_is_dir .git/rebase-apply &&
479 test_cmp_rev lorem2^^ HEAD
482 test_expect_success 'am --resolved works' '
483 echo goodbye >expected &&
484 rm -fr .git/rebase-apply &&
485 git reset --hard &&
486 git checkout lorem2^^ &&
487 test_must_fail git am lorem-move.patch &&
488 test -d .git/rebase-apply &&
489 echo resolved >>file &&
490 git add file &&
491 git am --resolved &&
492 test_path_is_missing .git/rebase-apply &&
493 test_cmp expected another
496 test_expect_success 'am --resolved fails if index has no changes' '
497 rm -fr .git/rebase-apply &&
498 git reset --hard &&
499 git checkout lorem2^^ &&
500 test_must_fail git am lorem-move.patch &&
501 test_path_is_dir .git/rebase-apply &&
502 test_cmp_rev lorem2^^ HEAD &&
503 test_must_fail git am --resolved &&
504 test_path_is_dir .git/rebase-apply &&
505 test_cmp_rev lorem2^^ HEAD
508 test_expect_success 'am --resolved fails if index has unmerged entries' '
509 rm -fr .git/rebase-apply &&
510 git reset --hard &&
511 git checkout second &&
512 test_must_fail git am -3 lorem-move.patch &&
513 test_path_is_dir .git/rebase-apply &&
514 test_cmp_rev second HEAD &&
515 test_must_fail git am --resolved >err &&
516 test_path_is_dir .git/rebase-apply &&
517 test_cmp_rev second HEAD &&
518 test_i18ngrep "still have unmerged paths" err
521 test_expect_success 'am takes patches from a Pine mailbox' '
522 rm -fr .git/rebase-apply &&
523 git reset --hard &&
524 git checkout first &&
525 cat pine patch1 | git am &&
526 test_path_is_missing .git/rebase-apply &&
527 git diff --exit-code master^..HEAD
530 test_expect_success 'am fails on mail without patch' '
531 rm -fr .git/rebase-apply &&
532 git reset --hard &&
533 test_must_fail git am <failmail &&
534 git am --abort &&
535 test_path_is_missing .git/rebase-apply
538 test_expect_success 'am fails on empty patch' '
539 rm -fr .git/rebase-apply &&
540 git reset --hard &&
541 echo "---" >>failmail &&
542 test_must_fail git am <failmail &&
543 git am --skip &&
544 test_path_is_missing .git/rebase-apply
547 test_expect_success 'am works from stdin in subdirectory' '
548 rm -fr subdir &&
549 rm -fr .git/rebase-apply &&
550 git reset --hard &&
551 git checkout first &&
553 mkdir -p subdir &&
554 cd subdir &&
555 git am <../patch1
556 ) &&
557 git diff --exit-code second
560 test_expect_success 'am works from file (relative path given) in subdirectory' '
561 rm -fr subdir &&
562 rm -fr .git/rebase-apply &&
563 git reset --hard &&
564 git checkout first &&
566 mkdir -p subdir &&
567 cd subdir &&
568 git am ../patch1
569 ) &&
570 git diff --exit-code second
573 test_expect_success 'am works from file (absolute path given) in subdirectory' '
574 rm -fr subdir &&
575 rm -fr .git/rebase-apply &&
576 git reset --hard &&
577 git checkout first &&
578 P=$(pwd) &&
580 mkdir -p subdir &&
581 cd subdir &&
582 git am "$P/patch1"
583 ) &&
584 git diff --exit-code second
587 test_expect_success 'am --committer-date-is-author-date' '
588 rm -fr .git/rebase-apply &&
589 git reset --hard &&
590 git checkout first &&
591 test_tick &&
592 git am --committer-date-is-author-date patch1 &&
593 git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
594 sed -ne "/^author /s/.*> //p" head1 >at &&
595 sed -ne "/^committer /s/.*> //p" head1 >ct &&
596 test_cmp at ct
599 test_expect_success 'am without --committer-date-is-author-date' '
600 rm -fr .git/rebase-apply &&
601 git reset --hard &&
602 git checkout first &&
603 test_tick &&
604 git am patch1 &&
605 git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
606 sed -ne "/^author /s/.*> //p" head1 >at &&
607 sed -ne "/^committer /s/.*> //p" head1 >ct &&
608 ! test_cmp at ct
611 # This checks for +0000 because TZ is set to UTC and that should
612 # show up when the current time is used. The date in message is set
613 # by test_tick that uses -0700 timezone; if this feature does not
614 # work, we will see that instead of +0000.
615 test_expect_success 'am --ignore-date' '
616 rm -fr .git/rebase-apply &&
617 git reset --hard &&
618 git checkout first &&
619 test_tick &&
620 git am --ignore-date patch1 &&
621 git cat-file commit HEAD | sed -e "/^\$/q" >head1 &&
622 sed -ne "/^author /s/.*> //p" head1 >at &&
623 grep "+0000" at
626 test_expect_success 'am into an unborn branch' '
627 git rev-parse first^{tree} >expected &&
628 rm -fr .git/rebase-apply &&
629 git reset --hard &&
630 rm -fr subdir &&
631 mkdir subdir &&
632 git format-patch --numbered-files -o subdir -1 first &&
634 cd subdir &&
635 git init &&
636 git am 1
637 ) &&
639 cd subdir &&
640 git rev-parse HEAD^{tree} >../actual
641 ) &&
642 test_cmp expected actual
645 test_expect_success 'am newline in subject' '
646 rm -fr .git/rebase-apply &&
647 git reset --hard &&
648 git checkout first &&
649 test_tick &&
650 sed -e "s/second/second \\\n foo/" patch1 >patchnl &&
651 git am <patchnl >output.out 2>&1 &&
652 test_i18ngrep "^Applying: second \\\n foo$" output.out
655 test_expect_success 'am -q is quiet' '
656 rm -fr .git/rebase-apply &&
657 git reset --hard &&
658 git checkout first &&
659 test_tick &&
660 git am -q <patch1 >output.out 2>&1 &&
661 ! test -s output.out
664 test_expect_success 'am empty-file does not infloop' '
665 rm -fr .git/rebase-apply &&
666 git reset --hard &&
667 touch empty-file &&
668 test_tick &&
669 test_must_fail git am empty-file 2>actual &&
670 echo Patch format detection failed. >expected &&
671 test_i18ncmp expected actual
674 test_expect_success 'am --message-id really adds the message id' '
675 rm -fr .git/rebase-apply &&
676 git reset --hard &&
677 git checkout HEAD^ &&
678 git am --message-id patch1.eml &&
679 test_path_is_missing .git/rebase-apply &&
680 git cat-file commit HEAD | tail -n1 >actual &&
681 grep Message-Id patch1.eml >expected &&
682 test_cmp expected actual
685 test_expect_success 'am.messageid really adds the message id' '
686 rm -fr .git/rebase-apply &&
687 git reset --hard &&
688 git checkout HEAD^ &&
689 test_config am.messageid true &&
690 git am patch1.eml &&
691 test_path_is_missing .git/rebase-apply &&
692 git cat-file commit HEAD | tail -n1 >actual &&
693 grep Message-Id patch1.eml >expected &&
694 test_cmp expected actual
697 test_expect_success 'am --message-id -s signs off after the message id' '
698 rm -fr .git/rebase-apply &&
699 git reset --hard &&
700 git checkout HEAD^ &&
701 git am -s --message-id patch1.eml &&
702 test_path_is_missing .git/rebase-apply &&
703 git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
704 grep Message-Id patch1.eml >expected &&
705 test_cmp expected actual
708 test_done