From fe8928e6e802f8519e133f085783fb664f1a0d6b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sat, 26 Apr 2008 23:19:06 +0200 Subject: [PATCH 1/3] git-format-patch: add a new format.cc configuration variable Some projects prefer to always CC patches to a given mailing list. In these cases, it's handy to configure that address once. Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- Documentation/git-format-patch.txt | 1 + builtin-log.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt index b5207b7604..2336b3e3c2 100644 --- a/Documentation/git-format-patch.txt +++ b/Documentation/git-format-patch.txt @@ -168,6 +168,7 @@ and file suffix, and number patches when outputting more than one. subjectprefix = CHANGE suffix = .txt numbered = auto + cc = ------------ diff --git a/builtin-log.c b/builtin-log.c index 1670d0b334..d7907c942f 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -485,6 +485,13 @@ static int git_format_config(const char *var, const char *value) fmt_patch_suffix = xstrdup(value); return 0; } + if (!strcmp(var, "format.cc")) { + if (!value) + return config_error_nonbool(var); + ALLOC_GROW(extra_cc, extra_cc_nr + 1, extra_cc_alloc); + extra_cc[extra_cc_nr++] = xstrdup(value); + return 0; + } if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) { return 0; } From 5f8b9fcd03af09fd7c55407af1f26833728278c2 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 27 Apr 2008 14:14:58 +0200 Subject: [PATCH 2/3] git-send-email: add a new sendemail.cc configuration variable Some projects prefer to always CC patches to a given mailing list. In these cases, it's handy to configure that address once. Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- git-send-email.perl | 1 + 1 file changed, 1 insertion(+) diff --git a/git-send-email.perl b/git-send-email.perl index 9e568bf9c0..cb05cf5b9e 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -203,6 +203,7 @@ my %config_settings = ( "smtpuser" => \$smtp_authuser, "smtppass" => \$smtp_authpass, "to" => \@to, + "cc" => \@initial_cc, "cccmd" => \$cc_cmd, "aliasfiletype" => \$aliasfiletype, "bcc" => \@bcclist, From 33c592ddd55faa96d0f425710da5742339796b89 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 29 Apr 2008 12:56:47 +0200 Subject: [PATCH 3/3] Add tests for sendemail.cc configuration variable Signed-off-by: Miklos Vajna Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index c0973b4e6e..af655cf526 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -166,4 +166,70 @@ test_expect_success 'second message is patch' ' grep "Subject:.*Second" msgtxt2 ' +cat >expected-show-all-headers <<\EOF +0001-Second.patch +(mbox) Adding cc: A from line 'From: A ' +Dry-OK. Log says: +Server: relay.example.com +MAIL FROM: +RCPT TO:,, +From: Example +To: to@example.com +Cc: cc@example.com, A +Subject: [PATCH 1/1] Second. +Date: DATE-STRING +Message-Id: MESSAGE-ID-STRING +X-Mailer: X-MAILER-STRING + +Result: OK +EOF + +test_expect_success 'sendemail.cc set' ' + git config sendemail.cc cc@example.com && + git send-email \ + --dry-run \ + --from="Example " \ + --to=to@example.com \ + --smtp-server relay.example.com \ + $patches | + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + >actual-show-all-headers && + test_cmp expected-show-all-headers actual-show-all-headers +' + +cat >expected-show-all-headers <<\EOF +0001-Second.patch +(mbox) Adding cc: A from line 'From: A ' +Dry-OK. Log says: +Server: relay.example.com +MAIL FROM: +RCPT TO:, +From: Example +To: to@example.com +Cc: A +Subject: [PATCH 1/1] Second. +Date: DATE-STRING +Message-Id: MESSAGE-ID-STRING +X-Mailer: X-MAILER-STRING + +Result: OK +EOF + +test_expect_success 'sendemail.cc unset' ' + git config --unset sendemail.cc && + git send-email \ + --dry-run \ + --from="Example " \ + --to=to@example.com \ + --smtp-server relay.example.com \ + $patches | + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + >actual-show-all-headers && + test_cmp expected-show-all-headers actual-show-all-headers +' + test_done