3 # Copyright (c) 2006 Junio C Hamano
6 test_description
='various format-patch tests'
9 .
"$TEST_DIRECTORY"/lib-terminal.sh
11 test_expect_success setup
'
13 for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file &&
17 git commit -m Initial &&
18 git checkout -b side &&
20 for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
23 git commit -m "Side changes #1" &&
25 for i in D E F; do echo "$i"; done >>file &&
26 git update-index file &&
28 git commit -m "Side changes #2" &&
31 for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
32 git update-index file &&
34 git commit -m "Side changes #3 with \\n backslash-n in it." &&
36 git checkout master &&
37 git diff-tree -p C2 | git apply --index &&
39 git commit -m "Master accepts moral equivalent of #2"
43 test_expect_success
"format-patch --ignore-if-in-upstream" '
45 git format-patch --stdout master..side >patch0 &&
46 cnt=`grep "^From " patch0 | wc -l` &&
51 test_expect_success
"format-patch --ignore-if-in-upstream" '
53 git format-patch --stdout \
54 --ignore-if-in-upstream master..side >patch1 &&
55 cnt=`grep "^From " patch1 | wc -l` &&
60 test_expect_success
"format-patch doesn't consider merge commits" '
62 git checkout -b slave master &&
63 echo "Another line" >>file &&
65 git commit -am "Slave change #1" &&
66 echo "Yet another line" >>file &&
68 git commit -am "Slave change #2" &&
69 git checkout -b merger master &&
71 git merge --no-ff slave &&
72 cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` &&
76 test_expect_success
"format-patch result applies" '
78 git checkout -b rebuild-0 master &&
80 cnt=`git rev-list master.. | wc -l` &&
84 test_expect_success
"format-patch --ignore-if-in-upstream result applies" '
86 git checkout -b rebuild-1 master &&
88 cnt=`git rev-list master.. | wc -l` &&
92 test_expect_success
'commit did not screw up the log message' '
94 git cat-file commit side | grep "^Side .* with .* backslash-n"
98 test_expect_success
'format-patch did not screw up the log message' '
100 grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 &&
101 grep "^Subject: .*Side changes #3 with .* backslash-n" patch1
105 test_expect_success
'replay did not screw up the log message' '
107 git cat-file commit rebuild-1 | grep "^Side .* with .* backslash-n"
111 test_expect_success
'extra headers' '
113 git config format.headers "To: R. E. Cipient <rcipient@example.com>
115 git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>
117 git format-patch --stdout master..side > patch2 &&
118 sed -e "/^\$/q" patch2 > hdrs2 &&
119 grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs2 &&
120 grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs2
124 test_expect_success
'extra headers without newlines' '
126 git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
127 git config --add format.headers "Cc: S. E. Cipient <scipient@example.com>" &&
128 git format-patch --stdout master..side >patch3 &&
129 sed -e "/^\$/q" patch3 > hdrs3 &&
130 grep "^To: R. E. Cipient <rcipient@example.com>\$" hdrs3 &&
131 grep "^Cc: S. E. Cipient <scipient@example.com>\$" hdrs3
135 test_expect_success
'extra headers with multiple To:s' '
137 git config --replace-all format.headers "To: R. E. Cipient <rcipient@example.com>" &&
138 git config --add format.headers "To: S. E. Cipient <scipient@example.com>" &&
139 git format-patch --stdout master..side > patch4 &&
140 sed -e "/^\$/q" patch4 > hdrs4 &&
141 grep "^To: R. E. Cipient <rcipient@example.com>,\$" hdrs4 &&
142 grep "^ *S. E. Cipient <scipient@example.com>\$" hdrs4
145 test_expect_success
'additional command line cc' '
147 git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
148 git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch5 &&
149 grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch5 &&
150 grep "^ *S. E. Cipient <scipient@example.com>\$" patch5
153 test_expect_success
'command line headers' '
155 git config --unset-all format.headers &&
156 git format-patch --add-header="Cc: R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch6 &&
157 grep "^Cc: R. E. Cipient <rcipient@example.com>\$" patch6
160 test_expect_success
'configuration headers and command line headers' '
162 git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
163 git format-patch --add-header="Cc: S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch7 &&
164 grep "^Cc: R. E. Cipient <rcipient@example.com>,\$" patch7 &&
165 grep "^ *S. E. Cipient <scipient@example.com>\$" patch7
168 test_expect_success
'command line To: header' '
170 git config --unset-all format.headers &&
171 git format-patch --to="R. E. Cipient <rcipient@example.com>" --stdout master..side | sed -e "/^\$/q" >patch8 &&
172 grep "^To: R. E. Cipient <rcipient@example.com>\$" patch8
175 test_expect_success
'configuration To: header' '
177 git config format.to "R. E. Cipient <rcipient@example.com>" &&
178 git format-patch --stdout master..side | sed -e "/^\$/q" >patch9 &&
179 grep "^To: R. E. Cipient <rcipient@example.com>\$" patch9
182 # check_patch <patch>: Verify that <patch> looks like a half-sane
183 # patch email to avoid a false positive with !grep
185 grep -e "^From:" "$1" &&
186 grep -e "^Date:" "$1" &&
187 grep -e "^Subject:" "$1"
190 test_expect_success
'--no-to overrides config.to' '
192 git config --replace-all format.to \
193 "R. E. Cipient <rcipient@example.com>" &&
194 git format-patch --no-to --stdout master..side |
195 sed -e "/^\$/q" >patch10 &&
196 check_patch patch10 &&
197 ! grep "^To: R. E. Cipient <rcipient@example.com>\$" patch10
200 test_expect_success
'--no-to and --to replaces config.to' '
202 git config --replace-all format.to \
203 "Someone <someone@out.there>" &&
204 git format-patch --no-to --to="Someone Else <else@out.there>" \
205 --stdout master..side |
206 sed -e "/^\$/q" >patch11 &&
207 check_patch patch11 &&
208 ! grep "^To: Someone <someone@out.there>\$" patch11 &&
209 grep "^To: Someone Else <else@out.there>\$" patch11
212 test_expect_success
'--no-cc overrides config.cc' '
214 git config --replace-all format.cc \
215 "C. E. Cipient <rcipient@example.com>" &&
216 git format-patch --no-cc --stdout master..side |
217 sed -e "/^\$/q" >patch12 &&
218 check_patch patch12 &&
219 ! grep "^Cc: C. E. Cipient <rcipient@example.com>\$" patch12
222 test_expect_success
'--no-add-header overrides config.headers' '
224 git config --replace-all format.headers \
225 "Header1: B. E. Cipient <rcipient@example.com>" &&
226 git format-patch --no-add-header --stdout master..side |
227 sed -e "/^\$/q" >patch13 &&
228 check_patch patch13 &&
229 ! grep "^Header1: B. E. Cipient <rcipient@example.com>\$" patch13
232 test_expect_success
'multiple files' '
236 git format-patch -o patches/ master &&
237 ls patches/0001-Side-changes-1.patch patches/0002-Side-changes-2.patch patches/0003-Side-changes-3-with-n-backslash-n-in-it.patch
240 test_expect_success
'reroll count' '
242 git format-patch -o patches --cover-letter --reroll-count 4 master..side >list &&
243 ! grep -v "^patches/v4-000[0-3]-" list &&
244 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
245 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
248 test_expect_success
'reroll count (-v)' '
250 git format-patch -o patches --cover-letter -v4 master..side >list &&
251 ! grep -v "^patches/v4-000[0-3]-" list &&
252 sed -n -e "/^Subject: /p" $(cat list) >subjects &&
253 ! grep -v "^Subject: \[PATCH v4 [0-3]/3\] " subjects
259 (git format-patch
--stdout "$@"; echo $?
> status.out
) |
260 # Prints everything between the Message-ID and In-Reply-To,
261 # and replaces all Message-ID-lookalikes by a sequence number
263 if (/^(message-id|references|in-reply-to)/i) {
269 $h{$1}=$i++ if (/<([^>]+)>/ and !exists $h{$1});
270 for $k (keys %h) {s/$k/$h{$k}/};
273 print "---\n" if /^From /i;
275 test 0 = "$(cat status.out)" &&
276 test_cmp
"$expect" actual
279 cat >> expect.no-threading
<<EOF
285 test_expect_success
'no threading' '
287 check_threading expect.no-threading master
290 cat > expect.thread
<<EOF
303 test_expect_success
'thread' '
304 check_threading expect.thread --thread master
307 cat > expect.in-reply-to
<<EOF
322 test_expect_success
'thread in-reply-to' '
323 check_threading expect.in-reply-to --in-reply-to="<test.message>" \
327 cat > expect.cover-letter
<<EOF
344 test_expect_success
'thread cover-letter' '
345 check_threading expect.cover-letter --cover-letter --thread master
348 cat > expect.cl-irt
<<EOF
370 test_expect_success
'thread cover-letter in-reply-to' '
371 check_threading expect.cl-irt --cover-letter \
372 --in-reply-to="<test.message>" --thread master
375 test_expect_success
'thread explicit shallow' '
376 check_threading expect.cl-irt --cover-letter \
377 --in-reply-to="<test.message>" --thread=shallow master
380 cat > expect.deep
<<EOF
394 test_expect_success
'thread deep' '
395 check_threading expect.deep --thread=deep master
398 cat > expect.deep-irt
<<EOF
416 test_expect_success
'thread deep in-reply-to' '
417 check_threading expect.deep-irt --thread=deep \
418 --in-reply-to="<test.message>" master
421 cat > expect.deep-cl
<<EOF
441 test_expect_success
'thread deep cover-letter' '
442 check_threading expect.deep-cl --cover-letter --thread=deep master
445 cat > expect.deep-cl-irt
<<EOF
470 test_expect_success
'thread deep cover-letter in-reply-to' '
471 check_threading expect.deep-cl-irt --cover-letter \
472 --in-reply-to="<test.message>" --thread=deep master
475 test_expect_success
'thread via config' '
476 test_config format.thread true &&
477 check_threading expect.thread master
480 test_expect_success
'thread deep via config' '
481 test_config format.thread deep &&
482 check_threading expect.deep master
485 test_expect_success
'thread config + override' '
486 test_config format.thread deep &&
487 check_threading expect.thread --thread master
490 test_expect_success
'thread config + --no-thread' '
491 test_config format.thread deep &&
492 check_threading expect.no-threading --no-thread master
495 test_expect_success
'excessive subject' '
499 for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >>file &&
500 git update-index file &&
501 git commit -m "This is an excessively long subject line for a message due to the habit some projects have of not having a short, one-line subject at the start of the commit message, but rather sticking a whole paragraph right at the start as the only thing in the commit message. It had better not become the filename for the patch." &&
502 git format-patch -o patches/ master..side &&
503 ls patches/0004-This-is-an-excessively-long-subject-line-for-a-messa.patch
506 test_expect_success
'cover-letter inherits diff options' '
510 git format-patch --cover-letter -1 &&
511 check_patch 0000-cover-letter.patch &&
512 ! grep "file => foo .* 0 *\$" 0000-cover-letter.patch &&
513 git format-patch --cover-letter -1 -M &&
514 grep "file => foo .* 0 *\$" 0000-cover-letter.patch
519 This is an excessively long subject line for a message due to the
520 habit some projects have of not having a short, one-line subject at
521 the start of the commit message, but rather sticking a whole
522 paragraph right at the start as the only thing in the commit
523 message. It had better not become the filename for the patch.
528 test_expect_success
'shortlog of cover-letter wraps overly-long onelines' '
530 git format-patch --cover-letter -2 &&
531 sed -e "1,/A U Thor/d" -e "/^\$/q" < 0000-cover-letter.patch > output &&
532 test_cmp expect output
537 index 40f36c6..2dc5c23 100644
548 test_expect_success
'format-patch respects -U' '
550 git format-patch -U4 -2 &&
551 sed -e "1,/^diff/d" -e "/^+5/q" \
552 <0001-This-is-an-excessively-long-subject-line-for-a-messa.patch \
554 test_cmp expect output
560 diff --git a/file b/file
561 index 40f36c6..2dc5c23 100644
571 test_expect_success
'format-patch -p suppresses stat' '
573 git format-patch -p -2 &&
574 sed -e "1,/^\$/d" -e "/^+5/q" < 0001-This-is-an-excessively-long-subject-line-for-a-messa.patch > output &&
575 test_cmp expect output
579 test_expect_success
'format-patch from a subdirectory (1)' '
590 echo "Oops? $filename"
597 test_expect_success
'format-patch from a subdirectory (2)' '
602 git format-patch -1 -o ..
608 echo "Oops? $filename"
612 basename=$(expr "$filename" : ".*/\(.*\)") &&
613 test -f "sub/$basename"
616 test_expect_success
'format-patch from a subdirectory (3)' '
622 git format-patch -1 -o "$TRASH_DIRECTORY"
624 basename=$(expr "$filename" : ".*/\(.*\)") &&
628 test_expect_success
'format-patch --in-reply-to' '
629 git format-patch -1 --stdout --in-reply-to "baz@foo.bar" > patch8 &&
630 grep "^In-Reply-To: <baz@foo.bar>" patch8 &&
631 grep "^References: <baz@foo.bar>" patch8
634 test_expect_success
'format-patch --signoff' '
635 git format-patch -1 --signoff --stdout |
636 grep "^Signed-off-by: $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
639 echo "fatal: --name-only does not make sense" > expect.name-only
640 echo "fatal: --name-status does not make sense" > expect.name-status
641 echo "fatal: --check does not make sense" > expect.check
643 test_expect_success
'options no longer allowed for format-patch' '
644 test_must_fail git format-patch --name-only 2> output &&
645 test_i18ncmp expect.name-only output &&
646 test_must_fail git format-patch --name-status 2> output &&
647 test_i18ncmp expect.name-status output &&
648 test_must_fail git format-patch --check 2> output &&
649 test_i18ncmp expect.check output'
651 test_expect_success
'format-patch --numstat should produce a patch' '
652 git format-patch --numstat --stdout master..side > output &&
653 test 6 = $(grep "^diff --git a/" output | wc -l)'
655 test_expect_success
'format-patch -- <path>' '
656 git format-patch master..side -- file 2>error &&
657 ! grep "Use .--" error
660 test_expect_success
'format-patch --ignore-if-in-upstream HEAD' '
661 git format-patch --ignore-if-in-upstream HEAD
664 test_expect_success
'format-patch --signature' '
665 git format-patch --stdout --signature="my sig" -1 >output &&
669 test_expect_success
'format-patch with format.signature config' '
670 git config format.signature "config sig" &&
671 git format-patch --stdout -1 >output &&
672 grep "config sig" output
675 test_expect_success
'format-patch --signature overrides format.signature' '
676 git config format.signature "config sig" &&
677 git format-patch --stdout --signature="overrides" -1 >output &&
678 ! grep "config sig" output &&
679 grep "overrides" output
682 test_expect_success
'format-patch --no-signature ignores format.signature' '
683 git config format.signature "config sig" &&
684 git format-patch --stdout --signature="my sig" --no-signature \
686 check_patch output &&
687 ! grep "config sig" output &&
688 ! grep "my sig" output &&
689 ! grep "^-- \$" output
692 test_expect_success
'format-patch --signature --cover-letter' '
693 git config --unset-all format.signature &&
694 git format-patch --stdout --signature="my sig" --cover-letter \
696 grep "my sig" output &&
697 test 2 = $(grep "my sig" output | wc -l)
700 test_expect_success
'format.signature="" supresses signatures' '
701 git config format.signature "" &&
702 git format-patch --stdout -1 >output &&
703 check_patch output &&
704 ! grep "^-- \$" output
707 test_expect_success
'format-patch --no-signature supresses signatures' '
708 git config --unset-all format.signature &&
709 git format-patch --stdout --no-signature -1 >output &&
710 check_patch output &&
711 ! grep "^-- \$" output
714 test_expect_success
'format-patch --signature="" supresses signatures' '
715 git format-patch --stdout --signature="" -1 >output &&
716 check_patch output &&
717 ! grep "^-- \$" output
720 test_expect_success TTY
'format-patch --stdout paginates' '
723 GIT_PAGER="wc >pager_used" &&
725 test_terminal git format-patch --stdout --all
727 test_path_is_file pager_used
730 test_expect_success TTY
'format-patch --stdout pagination can be disabled' '
733 GIT_PAGER="wc >pager_used" &&
735 test_terminal git --no-pager format-patch --stdout --all &&
736 test_terminal git -c "pager.format-patch=false" format-patch --stdout --all
738 test_path_is_missing pager_used &&
739 test_path_is_missing .git/pager_used
742 test_expect_success
'format-patch handles multi-line subjects' '
744 echo content >>file &&
745 for i in one two three; do echo $i; done >msg &&
748 git format-patch -o patches -1 &&
749 grep ^Subject: patches/0001-one.patch >actual &&
750 echo "Subject: [PATCH] one two three" >expect &&
751 test_cmp expect actual
754 test_expect_success
'format-patch handles multi-line encoded subjects' '
756 echo content >>file &&
757 for i in en två tre; do echo $i; done >msg &&
760 git format-patch -o patches -1 &&
761 grep ^Subject: patches/0001-en.patch >actual &&
762 echo "Subject: [PATCH] =?UTF-8?q?en=20tv=C3=A5=20tre?=" >expect &&
763 test_cmp expect actual
767 M64
=$M8$M8$M8$M8$M8$M8$M8$M8
768 M512
=$M64$M64$M64$M64$M64$M64$M64$M64
770 Subject: [PATCH] foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
771 bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
772 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
773 bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
774 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
775 bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
776 foo bar foo bar foo bar foo bar foo bar foo bar foo bar foo
777 bar foo bar foo bar foo bar foo bar foo bar foo bar foo bar
778 foo bar foo bar foo bar foo bar
780 test_expect_success
'format-patch wraps extremely long headers (ascii)' '
781 echo content >>file &&
783 git commit -m "$M512" &&
784 git format-patch --stdout -1 >patch &&
785 sed -n "/^Subject/p; /^ /p; /^$/q" <patch >subject &&
786 test_cmp expect subject
790 M64
=$M8$M8$M8$M8$M8$M8$M8$M8
791 M512
=$M64$M64$M64$M64$M64$M64$M64$M64
793 Subject: [PATCH] =?UTF-8?q?f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
794 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
795 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
796 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
797 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
798 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
799 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
800 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
801 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
802 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
803 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
804 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
805 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
806 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
807 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
808 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
809 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
810 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
811 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
812 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
813 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6=C3=B6=20bar=20f=C3=B6?=
814 =?UTF-8?q?=C3=B6=20bar=20f=C3=B6=C3=B6=20bar?=
816 test_expect_success
'format-patch wraps extremely long headers (rfc2047)' '
818 echo content >>file &&
820 git commit -m "$M512" &&
821 git format-patch --stdout -1 >patch &&
822 sed -n "/^Subject/p; /^ /p; /^$/q" <patch >subject &&
823 test_cmp expect subject
827 M64
=$M8$M8$M8$M8$M8$M8$M8$M8
832 test_expect_success
'format-patch wraps non-quotable headers' '
834 echo content >>file &&
836 git commit -mfoo --author "$M64 <foobar@foo.bar>" &&
837 git format-patch --stdout -1 >patch &&
838 sed -n "/^From: /p; /^ /p; /^$/q" <patch >from &&
843 echo content
>>file &&
845 GIT_AUTHOR_NAME
=$1 git commit
-m author-check
&&
846 git format-patch
--stdout -1 >patch &&
847 grep ^From
: patch >actual
&&
848 test_cmp expect actual
852 From: "Foo B. Bar" <author@example.com>
854 test_expect_success
'format-patch quotes dot in headers' '
855 check_author "Foo B. Bar"
859 From: "Foo \"The Baz\" Bar" <author@example.com>
861 test_expect_success
'format-patch quotes double-quote in headers' '
862 check_author "Foo \"The Baz\" Bar"
866 From: =?UTF-8?q?"F=C3=B6o=20B.=20Bar"?= <author@example.com>
868 test_expect_success
'rfc2047-encoded headers also double-quote 822 specials' '
869 check_author "Föo B. Bar"
873 Subject: header with . in it
875 test_expect_success
'subject lines do not have 822 atom-quoting' '
876 echo content >>file &&
878 git commit -m "header with . in it" &&
879 git format-patch -k -1 --stdout >patch &&
880 grep ^Subject: patch >actual &&
881 test_cmp expect actual
885 Subject: [PREFIX 1/1] header with . in it
887 test_expect_success
'subject prefixes have space prepended' '
888 git format-patch -n -1 --stdout --subject-prefix=PREFIX >patch &&
889 grep ^Subject: patch >actual &&
890 test_cmp expect actual
894 Subject: [1/1] header with . in it
896 test_expect_success
'empty subject prefix does not have extra space' '
897 git format-patch -n -1 --stdout --subject-prefix= >patch &&
898 grep ^Subject: patch >actual &&
899 test_cmp expect actual
902 test_expect_success
'format patch ignores color.ui' '
903 test_unconfig color.ui &&
904 git format-patch --stdout -1 >expect &&
905 test_config color.ui always &&
906 git format-patch --stdout -1 >actual &&
907 test_cmp expect actual