* [PATCH] git-format-patch: add a new format.cc configuration variable
@ 2008-04-26 21:19 Miklos Vajna
2008-04-26 22:31 ` Johannes Schindelin
0 siblings, 1 reply; 12+ messages in thread
From: Miklos Vajna @ 2008-04-26 21:19 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
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 <vmiklos@frugalware.org>
---
Documentation/git-format-patch.txt | 1 +
builtin-log.c | 7 +++++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index b5207b7..b2bdcb2 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 = <email>
------------
diff --git a/builtin-log.c b/builtin-log.c
index 1670d0b..d7907c9 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;
}
--
1.5.5.1.91.g499fc.dirty
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] git-format-patch: add a new format.cc configuration variable
2008-04-26 21:19 [PATCH] git-format-patch: add a new format.cc configuration variable Miklos Vajna
@ 2008-04-26 22:31 ` Johannes Schindelin
2008-04-26 23:27 ` Miklos Vajna
2008-04-27 0:14 ` Junio C Hamano
0 siblings, 2 replies; 12+ messages in thread
From: Johannes Schindelin @ 2008-04-26 22:31 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Junio C Hamano, git
Hi,
On Sat, 26 Apr 2008, Miklos Vajna wrote:
> Some projects prefer to always CC patches to a given mailing list. In
> these cases, it's handy to configure that address once.
I am wary... should this not be specific to send-email? IOW should
format-patch not be left alone?
Ciao,
Dscho
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] git-format-patch: add a new format.cc configuration variable
2008-04-26 22:31 ` Johannes Schindelin
@ 2008-04-26 23:27 ` Miklos Vajna
2008-04-27 11:53 ` Johannes Schindelin
2008-04-27 0:14 ` Junio C Hamano
1 sibling, 1 reply; 12+ messages in thread
From: Miklos Vajna @ 2008-04-26 23:27 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
On Sat, Apr 26, 2008 at 11:31:13PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> I am wary... should this not be specific to send-email? IOW should
> format-patch not be left alone?
Yes and no. :-) I first searched for a --cc option in send-email, then
realized that only format-patch has one. So I made it configurable,
instead of adding a new option to send-email for the very same purpose
format-patch already has an option. But I may be wrong.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] git-format-patch: add a new format.cc configuration variable
2008-04-26 23:27 ` Miklos Vajna
@ 2008-04-27 11:53 ` Johannes Schindelin
2008-04-27 12:14 ` [PATCH] git-send-email: add a new sendemail.cc " Miklos Vajna
2008-04-29 17:21 ` [PATCH] git-format-patch: add a new format.cc " Jay Soffian
0 siblings, 2 replies; 12+ messages in thread
From: Johannes Schindelin @ 2008-04-27 11:53 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Junio C Hamano, git
Hi,
On Sun, 27 Apr 2008, Miklos Vajna wrote:
> On Sat, Apr 26, 2008 at 11:31:13PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > I am wary... should this not be specific to send-email? IOW should
> > format-patch not be left alone?
>
> Yes and no. :-) I first searched for a --cc option in send-email, then
> realized that only format-patch has one.
You are completely correct, sorry. Hmm. I would have preferred
send-email inserting that header, oh well.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] git-send-email: add a new sendemail.cc configuration variable
2008-04-27 11:53 ` Johannes Schindelin
@ 2008-04-27 12:14 ` Miklos Vajna
2008-04-27 20:26 ` Junio C Hamano
2008-04-29 17:21 ` [PATCH] git-format-patch: add a new format.cc " Jay Soffian
1 sibling, 1 reply; 12+ messages in thread
From: Miklos Vajna @ 2008-04-27 12:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
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 <vmiklos@frugalware.org>
---
On Sun, Apr 27, 2008 at 12:53:34PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Yes and no. :-) I first searched for a --cc option in send-email,
> > then
> > realized that only format-patch has one.
>
> You are completely correct, sorry. Hmm. I would have preferred
> send-email inserting that header, oh well.
Heh, no. git-send-email has a --cc option as well, just it was not
configurable. Here is a one-liner which does the trick.
git-send-email.perl | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index 9e568bf..cb05cf5 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,
--
1.5.5.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] git-send-email: add a new sendemail.cc configuration variable
2008-04-27 12:14 ` [PATCH] git-send-email: add a new sendemail.cc " Miklos Vajna
@ 2008-04-27 20:26 ` Junio C Hamano
2008-04-27 22:42 ` Miklos Vajna
2008-04-29 10:56 ` [PATCH] Add tests for " Miklos Vajna
0 siblings, 2 replies; 12+ messages in thread
From: Junio C Hamano @ 2008-04-27 20:26 UTC (permalink / raw)
To: Miklos Vajna; +Cc: Johannes Schindelin, git
Miklos Vajna <vmiklos@frugalware.org> writes:
> 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 <vmiklos@frugalware.org>
> ---
>
> On Sun, Apr 27, 2008 at 12:53:34PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>> > Yes and no. :-) I first searched for a --cc option in send-email,
>> > then
>> > realized that only format-patch has one.
>>
>> You are completely correct, sorry. Hmm. I would have preferred
>> send-email inserting that header, oh well.
>
> Heh, no. git-send-email has a --cc option as well, just it was not
> configurable. Here is a one-liner which does the trick.
Thanks, the idea makes sense.
Tests?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] git-send-email: add a new sendemail.cc configuration variable
2008-04-27 20:26 ` Junio C Hamano
@ 2008-04-27 22:42 ` Miklos Vajna
2008-04-27 23:51 ` Jeff King
2008-04-29 10:56 ` [PATCH] Add tests for " Miklos Vajna
1 sibling, 1 reply; 12+ messages in thread
From: Miklos Vajna @ 2008-04-27 22:42 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
[-- Attachment #1: Type: text/plain, Size: 365 bytes --]
On Sun, Apr 27, 2008 at 01:26:48PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks, the idea makes sense.
>
> Tests?
As far as I see, none of the sendemail.* configuration variables have
tests. Should I add a test for each of them?
Also, what is the preferred way of the testing method in this case?
Should I just rely on a --dry-run output?
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] git-send-email: add a new sendemail.cc configuration variable
2008-04-27 22:42 ` Miklos Vajna
@ 2008-04-27 23:51 ` Jeff King
0 siblings, 0 replies; 12+ messages in thread
From: Jeff King @ 2008-04-27 23:51 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin
On Mon, Apr 28, 2008 at 12:42:55AM +0200, Miklos Vajna wrote:
> Also, what is the preferred way of the testing method in this case?
> Should I just rely on a --dry-run output?
Look in t9001; there is a fake sendmail wrapper that outputs the sent
messages to files. You can then inspect the files to see that the
correct headers were added.
-Peff
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Add tests for sendemail.cc configuration variable
2008-04-27 20:26 ` Junio C Hamano
2008-04-27 22:42 ` Miklos Vajna
@ 2008-04-29 10:56 ` Miklos Vajna
1 sibling, 0 replies; 12+ messages in thread
From: Miklos Vajna @ 2008-04-29 10:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, git
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
On Sun, Apr 27, 2008 at 01:26:48PM -0700, Junio C Hamano <gitster@pobox.com> wrote:
> Thanks, the idea makes sense.
>
> Tests?
Here it is.
(Sorry for the duplication, I forgot to CC the list.)
t/t9001-send-email.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index c0973b4..af655cf 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 <author@example.com> from line 'From: A <author@example.com>'
+Dry-OK. Log says:
+Server: relay.example.com
+MAIL FROM:<from@example.com>
+RCPT TO:<to@example.com>,<cc@example.com>,<author@example.com>
+From: Example <from@example.com>
+To: to@example.com
+Cc: cc@example.com, A <author@example.com>
+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 <from@example.com>" \
+ --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 <author@example.com> from line 'From: A <author@example.com>'
+Dry-OK. Log says:
+Server: relay.example.com
+MAIL FROM:<from@example.com>
+RCPT TO:<to@example.com>,<author@example.com>
+From: Example <from@example.com>
+To: to@example.com
+Cc: A <author@example.com>
+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 <from@example.com>" \
+ --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
--
1.5.5.1.100.ge64d7
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] git-format-patch: add a new format.cc configuration variable
2008-04-27 11:53 ` Johannes Schindelin
2008-04-27 12:14 ` [PATCH] git-send-email: add a new sendemail.cc " Miklos Vajna
@ 2008-04-29 17:21 ` Jay Soffian
1 sibling, 0 replies; 12+ messages in thread
From: Jay Soffian @ 2008-04-29 17:21 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Miklos Vajna, Junio C Hamano, git
On Sun, Apr 27, 2008 at 7:53 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
>
> On Sun, 27 Apr 2008, Miklos Vajna wrote:
>
> > On Sat, Apr 26, 2008 at 11:31:13PM +0100, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > > I am wary... should this not be specific to send-email? IOW should
> > > format-patch not be left alone?
> >
> > Yes and no. :-) I first searched for a --cc option in send-email, then
> > realized that only format-patch has one.
>
> You are completely correct, sorry. Hmm. I would have preferred
> send-email inserting that header, oh well.
You can do something like:
[sendemail]
cccmd = "sh -c 'echo address@example.com'"
j.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] git-format-patch: add a new format.cc configuration variable
2008-04-26 22:31 ` Johannes Schindelin
2008-04-26 23:27 ` Miklos Vajna
@ 2008-04-27 0:14 ` Junio C Hamano
2008-04-27 5:09 ` [PATCH] bash: Add long option completion for 'git send-email' Teemu Likonen
1 sibling, 1 reply; 12+ messages in thread
From: Junio C Hamano @ 2008-04-27 0:14 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Miklos Vajna, git
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> I am wary... should this not be specific to send-email? IOW should
> format-patch not be left alone?
Yes, it should.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] bash: Add long option completion for 'git send-email'
2008-04-27 0:14 ` Junio C Hamano
@ 2008-04-27 5:09 ` Teemu Likonen
0 siblings, 0 replies; 12+ messages in thread
From: Teemu Likonen @ 2008-04-27 5:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Johannes Schindelin, Miklos Vajna, git
Add the following long options to be completed with 'git send-email':
--bcc --cc --cc-cmd --chain-reply-to --compose --dry-run
--envelope-sender --from --identity --in-reply-to --no-chain-reply-to
--no-signed-off-by-cc --no-suppress-from --no-thread --quiet
--signed-off-by-cc --smtp-pass --smtp-server --smtp-server-port
--smtp-ssl --smtp-user --subject --suppress-cc --suppress-from
--thread --to
Short ones like --to and --cc are not usable for actual completion
because of the shortness itself and because there are longer ones which
start with same letters (--thread, --compose). It's still useful to have
these shorter options _listed_ when user presses TAB key after typing
two dashes. It gives user an idea what options are available (and --to
and --cc are probably the most commonly used).
Signed-off-by: Teemu Likonen <tlikonen@iki.fi>
---
contrib/completion/git-completion.bash | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 665a895..a9a7015 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -875,6 +875,24 @@ _git_rebase ()
__gitcomp "$(__git_refs)"
}
+_git_send_email ()
+{
+ local cur="${COMP_WORDS[COMP_CWORD]}"
+ case "$cur" in
+ --*)
+ __gitcomp "--bcc --cc --cc-cmd --chain-reply-to --compose
+ --dry-run --envelope-sender --from --identity
+ --in-reply-to --no-chain-reply-to --no-signed-off-by-cc
+ --no-suppress-from --no-thread --quiet
+ --signed-off-by-cc --smtp-pass --smtp-server
+ --smtp-server-port --smtp-ssl --smtp-user --subject
+ --suppress-cc --suppress-from --thread --to"
+ return
+ ;;
+ esac
+ __git_complete_file
+}
+
_git_config ()
{
local cur="${COMP_WORDS[COMP_CWORD]}"
@@ -1331,6 +1349,7 @@ _git ()
rebase) _git_rebase ;;
remote) _git_remote ;;
reset) _git_reset ;;
+ send-email) _git_send_email ;;
shortlog) _git_shortlog ;;
show) _git_show ;;
show-branch) _git_log ;;
@@ -1383,6 +1402,7 @@ complete -o default -o nospace -F _git_rebase git-rebase
complete -o default -o nospace -F _git_config git-config
complete -o default -o nospace -F _git_remote git-remote
complete -o default -o nospace -F _git_reset git-reset
+complete -o default -o nospace -F _git_send_email git-send-email
complete -o default -o nospace -F _git_shortlog git-shortlog
complete -o default -o nospace -F _git_show git-show
complete -o default -o nospace -F _git_stash git-stash
--
1.5.5.1.94.g80fd
^ permalink raw reply related [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-04-29 17:23 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-26 21:19 [PATCH] git-format-patch: add a new format.cc configuration variable Miklos Vajna
2008-04-26 22:31 ` Johannes Schindelin
2008-04-26 23:27 ` Miklos Vajna
2008-04-27 11:53 ` Johannes Schindelin
2008-04-27 12:14 ` [PATCH] git-send-email: add a new sendemail.cc " Miklos Vajna
2008-04-27 20:26 ` Junio C Hamano
2008-04-27 22:42 ` Miklos Vajna
2008-04-27 23:51 ` Jeff King
2008-04-29 10:56 ` [PATCH] Add tests for " Miklos Vajna
2008-04-29 17:21 ` [PATCH] git-format-patch: add a new format.cc " Jay Soffian
2008-04-27 0:14 ` Junio C Hamano
2008-04-27 5:09 ` [PATCH] bash: Add long option completion for 'git send-email' Teemu Likonen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).