{"thread":{"id":"12195","subject":"[PATCH 4/4] Support a --cc=<email> option in format-patch","startedAt":"2008-02-19T07:40:35Z","lastAt":"2008-02-19T07:40:35Z","messageCount":1,"participants":["Daniel Barkalow"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"69242","messageId":"alpine.LNX.1.00.0802190240080.5816@iabervon.org","threadId":"12195","inReplyTo":null,"subject":"[PATCH 4/4] Support a --cc=<email> option in format-patch","fromName":"Daniel Barkalow","fromEmail":"barkalow@iabervon.org","sentAt":"2008-02-19T07:40:35Z","receivedAt":"2008-02-19T07:40:35Z","isPatch":true,"sender":{"key":"barkalow@iabervon.org","avatar":"https://avatars.githubusercontent.com/u/55364219?v=4"},"body":"When you have particular reviewers you want to sent particular series\nto, it's nice to be able to generate the whole series with them as\nadditional recipients, without configuring them into your general\nheaders or adding them by hand afterwards.\n\nSigned-off-by: Daniel Barkalow <barkalow@iabervon.org>\n---\n Documentation/git-format-patch.txt |    5 +++++\n builtin-log.c                      |    4 ++++\n t/t4014-format-patch.sh            |    8 ++++++++\n 3 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex b27bb94..b5207b7 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -17,6 +17,7 @@ SYNOPSIS\n \t\t   [--in-reply-to=Message-Id] [--suffix=.<sfx>]\n \t\t   [--ignore-if-in-upstream]\n \t\t   [--subject-prefix=Subject-Prefix]\n+\t\t   [--cc=<email>]\n \t\t   [--cover-letter]\n \t\t   [ <since> | <revision range> ]\n \n@@ -136,6 +137,10 @@ include::diff-options.txt[]\n \tallows for useful naming of a patch series, and can be\n \tcombined with the --numbered option.\n \n+--cc=<email>::\n+\tAdd a \"Cc:\" header to the email headers. This is in addition\n+\tto any configured headers, and may be used multiple times.\n+\n --cover-letter::\n \tGenerate a cover letter template.  You still have to fill in\n \ta description, but the shortlog and the diffstat will be\ndiff --git a/builtin-log.c b/builtin-log.c\nindex ae62668..e26c986 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -771,6 +771,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t\t\tdie(\"Need a number for --start-number\");\n \t\t\tstart_number = strtol(argv[i], NULL, 10);\n \t\t}\n+\t\telse if (!prefixcmp(argv[i], \"--cc=\")) {\n+\t\t\tALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc);\n+\t\t\textra_cc[extra_cc_nr++] = xstrdup(argv[i] + 5);\n+\t\t}\n \t\telse if (!strcmp(argv[i], \"-k\") ||\n \t\t\t\t!strcmp(argv[i], \"--keep-subject\")) {\n \t\t\tkeep_subject = 1;\ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex 43d8841..a39e786 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -122,6 +122,14 @@ test_expect_success 'extra headers with multiple To:s' '\n \tgrep \"^ *S. E. Cipient <scipient@example.com>$\" hdrs4\n '\n \n+test_expect_success 'additional command line cc' '\n+\n+\tgit config --replace-all format.headers \"Cc: R. E. Cipient <rcipient@example.com>\" &&\n+\tgit format-patch --cc=\"S. E. Cipient <scipient@example.com>\" --stdout master..side | sed -e \"/^$/Q\" >patch5 &&\n+\tgrep \"^Cc: R. E. Cipient <rcipient@example.com>,$\" patch5 &&\n+\tgrep \"^ *S. E. Cipient <scipient@example.com>$\" patch5\n+'\n+\n test_expect_success 'multiple files' '\n \n \trm -rf patches/ &&\n-- \n1.5.4.1.192.g8ea3a\n"}]}