# [PATCH] send-email: Add tocmd option to suppress-cc

7 messages from 2017-05-18 to 2017-06-14. Participants: Viresh Kumar, Junio C Hamano.
Thread: https://gitlist.dev/t/45994

## Viresh Kumar, 2017-05-18 11:35

Subject: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <6367777092d93a62cc83c444061dde853ba3369e.1495107179.git.viresh.kumar@linaro.org>
URL: https://gitlist.dev/e/6367777092d93a62cc83c444061dde853ba3369e.1495107179.git.viresh.kumar%40linaro.org

```
This adds tocmd option to suppress-cc command which already supports
cccmd and others.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 Documentation/git-send-email.txt | 1 +
 git-send-email.perl              | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 9d66166f69d9..f1634f7db3df 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -307,6 +307,7 @@ Automating
   patch body (commit message) except for self (use 'self' for that).
 - 'sob' will avoid including anyone mentioned in Signed-off-by lines except
    for self (use 'self' for that).
+- 'tocmd' will avoid running the --to-cmd.
 - 'cccmd' will avoid running the --cc-cmd.
 - 'body' is equivalent to 'sob' + 'bodycc'
 - 'all' will suppress all auto cc values.
diff --git a/git-send-email.perl b/git-send-email.perl
index eea0a517f71b..cc3cd984aee4 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -85,7 +85,7 @@ git send-email --dump-aliases
     --identity              <str>  * Use the sendemail.<id> options.
     --to-cmd                <str>  * Email To: via `<str> \$patch_path`
     --cc-cmd                <str>  * Email Cc: via `<str> \$patch_path`
-    --suppress-cc           <str>  * author, self, sob, cc, cccmd, body, bodycc, all.
+    --suppress-cc           <str>  * author, self, sob, cc, tocmd, cccmd, body, bodycc, all.
     --[no-]cc-cover                * Email Cc: addresses in the cover letter.
     --[no-]to-cover                * Email To: addresses in the cover letter.
     --[no-]signed-off-by-cc        * Send to Signed-off-by: addresses. Default on.
@@ -435,13 +435,13 @@ my(%suppress_cc);
 if (@suppress_cc) {
 	foreach my $entry (@suppress_cc) {
 		die sprintf(__("Unknown --suppress-cc field: '%s'\n"), $entry)
-			unless $entry =~ /^(?:all|cccmd|cc|author|self|sob|body|bodycc)$/;
+			unless $entry =~ /^(?:all|tocmd|cccmd|cc|author|self|sob|body|bodycc)$/;
 		$suppress_cc{$entry} = 1;
 	}
 }
 
 if ($suppress_cc{'all'}) {
-	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {
 		$suppress_cc{$entry} = 1;
 	}
 	delete $suppress_cc{'all'};
@@ -1582,7 +1582,7 @@ foreach my $t (@files) {
 	close $fh;
 
 	push @to, recipients_cmd("to-cmd", "to", $to_cmd, $t)
-		if defined $to_cmd;
+		if defined $to_cmd && !$suppress_cc{'tocmd'};
 	push @cc, recipients_cmd("cc-cmd", "cc", $cc_cmd, $t)
 		if defined $cc_cmd && !$suppress_cc{'cccmd'};
 
-- 
2.13.0.70.g6367777092d9


```

## Viresh Kumar, 2017-06-12 04:33

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <20170612043313.GE5297@vireshk-i7>
URL: https://gitlist.dev/e/20170612043313.GE5297%40vireshk-i7
In-Reply-To: <6367777092d93a62cc83c444061dde853ba3369e.1495107179.git.viresh.kumar@linaro.org>

```
On 18-05-17, 17:05, Viresh Kumar wrote:
> This adds tocmd option to suppress-cc command which already supports
> cccmd and others.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  Documentation/git-send-email.txt | 1 +
>  git-send-email.perl              | 8 ++++----
>  2 files changed, 5 insertions(+), 4 deletions(-)

Ping !!

-- 
viresh

```

## Junio C Hamano, 2017-06-12 16:11

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <xmqq8tkxp4nw.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq8tkxp4nw.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170612043313.GE5297@vireshk-i7>

```
Viresh Kumar <viresh.kumar@linaro.org> writes:

> On 18-05-17, 17:05, Viresh Kumar wrote:
>> This adds tocmd option to suppress-cc command which already supports
>> cccmd and others.
>> 
>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>> ---
>>  Documentation/git-send-email.txt | 1 +
>>  git-send-email.perl              | 8 ++++----
>>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> Ping !!

Pong?

I didn't get the impression that in the discussion that led to your
patch (or in any response to the patch) we established that it is a
good idea to change the behaviour of suppress-cc unconditionally
like this patch does.


```

## Junio C Hamano, 2017-06-12 18:04

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <xmqqmv9dnkut.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqmv9dnkut.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <xmqq8tkxp4nw.fsf@gitster.mtv.corp.google.com>

```
Junio C Hamano <gitster@pobox.com> writes:

> Viresh Kumar <viresh.kumar@linaro.org> writes:
>
>> On 18-05-17, 17:05, Viresh Kumar wrote:
>>> This adds tocmd option to suppress-cc command which already supports
>>> cccmd and others.
>>> 
>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>> ---
>>>  Documentation/git-send-email.txt | 1 +
>>>  git-send-email.perl              | 8 ++++----
>>>  2 files changed, 5 insertions(+), 4 deletions(-)
>>
>> Ping !!
>
> Pong?
>
> I didn't get the impression that in the discussion that led to your
> patch (or in any response to the patch) we established that it is a
> good idea to change the behaviour of suppress-cc unconditionally
> like this patch does.

I think suppress-cc that suppresses cccmd output is very sensible
(after all, it is about suppressing CC and cccmd is about producing
CC), but I am not convinced that it is a good idea to suppress tocmd
(which is about producing To) via suppress-cc.

Going back to the core part of your change, i.e.

-	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
+	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {

to think about it a bit more, I notice that all the existing ones
are about CC.  So I am not just not convinced that tocmd belongs to
the same class.  I am inclined to say that it smells quite different
from others.

```

## Viresh Kumar, 2017-06-13 03:43

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <20170613034337.GF5297@vireshk-i7>
URL: https://gitlist.dev/e/20170613034337.GF5297%40vireshk-i7
In-Reply-To: <xmqqmv9dnkut.fsf@gitster.mtv.corp.google.com>

```
On 12-06-17, 11:04, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
> > Viresh Kumar <viresh.kumar@linaro.org> writes:
> >
> >> On 18-05-17, 17:05, Viresh Kumar wrote:
> >>> This adds tocmd option to suppress-cc command which already supports
> >>> cccmd and others.
> >>> 
> >>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> >>> ---
> >>>  Documentation/git-send-email.txt | 1 +
> >>>  git-send-email.perl              | 8 ++++----
> >>>  2 files changed, 5 insertions(+), 4 deletions(-)
> >>
> >> Ping !!
> >
> > Pong?
> >
> > I didn't get the impression that in the discussion that led to your
> > patch (or in any response to the patch) we established that it is a
> > good idea to change the behaviour of suppress-cc unconditionally
> > like this patch does.

Yeah, there were no conclusions there but we agreed that we have a
problem to solve. And this patch tried one of the ways.

> I think suppress-cc that suppresses cccmd output is very sensible
> (after all, it is about suppressing CC and cccmd is about producing
> CC), but I am not convinced that it is a good idea to suppress tocmd
> (which is about producing To) via suppress-cc.
> 
> Going back to the core part of your change, i.e.
> 
> -	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
> +	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {
> 
> to think about it a bit more, I notice that all the existing ones
> are about CC.  So I am not just not convinced that tocmd belongs to
> the same class.  I am inclined to say that it smells quite different
> from others.

That's right but how do we solve this problem then?

Add another optional argument like suppress-to ? I thought that it
would be better to override suppress-cc rather than attempting any
such thing.

I am fine with any solution that address the concerns raised by this
patch though.

-- 
viresh

```

## Junio C Hamano, 2017-06-13 17:23

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <xmqqk24f7qep.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqqk24f7qep.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <20170613034337.GF5297@vireshk-i7>

```
Viresh Kumar <viresh.kumar@linaro.org> writes:

>> Going back to the core part of your change, i.e.
>> 
>> -	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
>> +	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {
>> 
>> to think about it a bit more, I notice that all the existing ones
>> are about CC.  So I am not just not convinced that tocmd belongs to
>> the same class.  I am inclined to say that it smells quite different
>> from others.
>
> That's right but how do we solve this problem then?
>
> Add another optional argument like suppress-to ? I thought that it
> would be better to override suppress-cc rather than attempting any
> such thing.
>
> I am fine with any solution that address the concerns raised by this
> patch though.

I am not sure what problem is being solved, quite honestly.  "I have
tocmd configured and I want a way not to specify tocmd for a single
invocation?"  Would something along the lines of 

    git -c sendemail.tocmd=true send-email ...

how you do it in general?  Do you want a prettier-looking
equivalent, e.g.

    git send-email --tocmd=true ...

or something like that?




```

## Viresh Kumar, 2017-06-14 03:47

Subject: Re: [PATCH] send-email: Add tocmd option to suppress-cc
Message-ID: <20170614034754.GI5297@vireshk-i7>
URL: https://gitlist.dev/e/20170614034754.GI5297%40vireshk-i7
In-Reply-To: <xmqqk24f7qep.fsf@gitster.mtv.corp.google.com>

```
On 13-06-17, 10:23, Junio C Hamano wrote:
> Viresh Kumar <viresh.kumar@linaro.org> writes:
> 
> >> Going back to the core part of your change, i.e.
> >> 
> >> -	foreach my $entry (qw (cccmd cc author self sob body bodycc)) {
> >> +	foreach my $entry (qw (tocmd cccmd cc author self sob body bodycc)) {
> >> 
> >> to think about it a bit more, I notice that all the existing ones
> >> are about CC.  So I am not just not convinced that tocmd belongs to
> >> the same class.  I am inclined to say that it smells quite different
> >> from others.
> >
> > That's right but how do we solve this problem then?
> >
> > Add another optional argument like suppress-to ? I thought that it
> > would be better to override suppress-cc rather than attempting any
> > such thing.
> >
> > I am fine with any solution that address the concerns raised by this
> > patch though.
> 
> I am not sure what problem is being solved, quite honestly.  "I have
> tocmd configured and I want a way not to specify tocmd for a single
> invocation?"  Would something along the lines of 
> 
>     git -c sendemail.tocmd=true send-email ...
> 
> how you do it in general?

Yeah, it works. I can use this instead.

This patch can be dropped now. Thanks.

-- 
viresh

```
