Skip to content

Commit

Permalink
Support a --cc=<email> option in format-patch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Barkalow authored and Junio C Hamano committed Feb 20, 2008
1 parent 3ee79d9 commit 736cc67
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Documentation/git-format-patch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ SYNOPSIS
[--in-reply-to=Message-Id] [--suffix=.<sfx>]
[--ignore-if-in-upstream]
[--subject-prefix=Subject-Prefix]
[--cc=<email>]
[--cover-letter]
[ <since> | <revision range> ]

Expand Down Expand Up @@ -136,6 +137,10 @@ include::diff-options.txt[]
allows for useful naming of a patch series, and can be
combined with the --numbered option.

--cc=<email>::
Add a "Cc:" header to the email headers. This is in addition
to any configured headers, and may be used multiple times.

--cover-letter::
Generate a cover letter template. You still have to fill in
a description, but the shortlog and the diffstat will be
Expand Down
4 changes: 4 additions & 0 deletions builtin-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
die("Need a number for --start-number");
start_number = strtol(argv[i], NULL, 10);
}
else if (!prefixcmp(argv[i], "--cc=")) {
ALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc);
extra_cc[extra_cc_nr++] = xstrdup(argv[i] + 5);
}
else if (!strcmp(argv[i], "-k") ||
!strcmp(argv[i], "--keep-subject")) {
keep_subject = 1;
Expand Down
8 changes: 8 additions & 0 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ test_expect_success 'extra headers with multiple To:s' '
grep "^ *S. E. Cipient <scipient@example.com>$" hdrs4
'

test_expect_success 'additional command line cc' '
git config --replace-all format.headers "Cc: R. E. Cipient <rcipient@example.com>" &&
git format-patch --cc="S. E. Cipient <scipient@example.com>" --stdout master..side | sed -e "/^$/Q" >patch5 &&
grep "^Cc: R. E. Cipient <rcipient@example.com>,$" patch5 &&
grep "^ *S. E. Cipient <scipient@example.com>$" patch5
'

test_expect_success 'multiple files' '
rm -rf patches/ &&
Expand Down

0 comments on commit 736cc67

Please sign in to comment.