Support a --cc=<email> option in format-patch
When you have particular reviewers you want to sent particular series to, it's nice to be able to generate the whole series with them as additional recipients, without configuring them into your general headers or adding them by hand afterwards. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Barkalow committed
Feb 19, 2008 at 02:40 UTC
736cc67dd7f4f8004215e24f876178e6f34c191d
3 files changed
+17
Documentation/git-format-patch.txt
+5
@@ -17,6 +17,7 @@ SYNOPSIS
17
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
18
[--ignore-if-in-upstream]
19
[--subject-prefix=Subject-Prefix]
20
+ [--cc=<email>]
21
[--cover-letter]
22
[ <since> | <revision range> ]
23
@@ -136,6 +137,10 @@ include::diff-options.txt[]
137
allows for useful naming of a patch series, and can be
138
combined with the --numbered option.
139
140
+--cc=<email>::
141
+ Add a "Cc:" header to the email headers. This is in addition
142
+ to any configured headers, and may be used multiple times.
143
+
144
--cover-letter::
145
Generate a cover letter template. You still have to fill in
146
a description, but the shortlog and the diffstat will be
builtin-log.c
+4
@@ -771,6 +771,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
771
die("Need a number for --start-number");
772
start_number = strtol(argv[i], NULL, 10);
773
}
774
+ else if (!prefixcmp(argv[i], "--cc=")) {
775
+ ALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc);
776
+ extra_cc[extra_cc_nr++] = xstrdup(argv[i] + 5);
777
+ }
778
else if (!strcmp(argv[i], "-k") ||
779
!strcmp(argv[i], "--keep-subject")) {
780
keep_subject = 1;
t/t4014-format-patch.sh
+8
@@ -122,6 +122,14 @@ test_expect_success 'extra headers with multiple To:s' '
122
grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
123
'
124
125
+test_expect_success 'additional command line cc' '
126
+
127
+ git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
128
+ git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/Q" >patch5 &&
129
+ grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch5 &&
130
+ grep "^ *S. E. Cipient <scipient@example.com>$" patch5
131
+'
132
+
133
test_expect_success 'multiple files' '
134
135
rm -rf patches/ &&