git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Support a --cc=<email> option in format-patch

From
Daniel Barkalow <barkalow@iabervon.org>
Date
Feb 19, 2008, 07:40 UTC
Message-ID
<alpine.LNX.1.00.0802190240080.5816@iabervon.org>

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>
---
 Documentation/git-format-patch.txt |    5 +++++
 builtin-log.c                      |    4 ++++
 t/t4014-format-patch.sh            |    8 ++++++++
 3 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index b27bb94..b5207b7 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -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> ]
 
@@ -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
diff --git a/builtin-log.c b/builtin-log.c
index ae62668..e26c986 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -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;
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 43d8841..a39e786 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -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/ &&
-- 
1.5.4.1.192.g8ea3a
Message 1 of 1 in “Support a --cc=<email> option in format-patch”
  1. 4/4 Support a --cc=<email> option in format-patchDaniel Barkalow, Feb 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.