git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Stimpfle <debian@jstimpfle.de>
To: git@vger.kernel.org
Cc: Jens Stimpfle <debian@jstimpfle.de>
Subject: [PATCH] git-send-email.perl: Fix handling of suppresscc option.
Date: Wed, 12 Nov 2014 14:18:11 +0000	[thread overview]
Message-ID: <1415801891-28471-1-git-send-email-debian@jstimpfle.de> (raw)

Signed-off-by: Jens Stimpfle <debian@jstimpfle.de>
---

Notes:
    This patch makes sure that "sob", "cc" and "bodycc" values for
    sendemail.suppresscc option are handled, even when the email-addresses in
    question are equal to the sender and "self" in not configured in
    sendemail.suppresscc.
    
    Sounds complicated, I know. But the current behaviour is really confusing: For
    example, when sending, git-send-email logs
    
    (mbox) Adding cc: Jens Stimpfle <debian@jstimpfle.de> from line 'From: Jens Stimpfle <debian@jstimpfle.de>'
    (body) Adding cc: Jens Stimpfle <debian@jstimpfle.de> from line 'Signed-off-by: Jens Stimpfle <debian@jstimpfle.de>'
    
    even though I have "sob" configured in sendemail.suppresscc.
    
    With this patch, the suppression handling is also made consistent with the
    handling of the "author" value.

 git-send-email.perl | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 9949db0..452a783 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1377,11 +1377,8 @@ foreach my $t (@files) {
 				foreach my $addr (parse_address_line($1)) {
 					my $qaddr = unquote_rfc2047($addr);
 					my $saddr = sanitize_address($qaddr);
-					if ($saddr eq $sender) {
-						next if ($suppress_cc{'self'});
-					} else {
-						next if ($suppress_cc{'cc'});
-					}
+					next if $suppress_cc{'cc'};
+					next if $suppress_cc{'self'} and $saddr eq $sender;
 					printf("(mbox) Adding cc: %s from line '%s'\n",
 						$addr, $_) unless $quiet;
 					push @cc, $addr;
@@ -1425,12 +1422,9 @@ foreach my $t (@files) {
 			my ($what, $c) = ($1, $2);
 			chomp $c;
 			my $sc = sanitize_address($c);
-			if ($sc eq $sender) {
-				next if ($suppress_cc{'self'});
-			} else {
-				next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
-				next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
-			}
+			next if $suppress_cc{'sob'} and $what =~ /Signed-off-by/i;
+			next if $suppress_cc{'bodycc'} and $what =~ /Cc/i;
+			next if $suppress_cc{'self'} and $sc eq $sender;
 			push @cc, $c;
 			printf("(body) Adding cc: %s from line '%s'\n",
 				$c, $_) unless $quiet;
-- 
2.1.1

             reply	other threads:[~2014-11-12 13:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 14:18 Jens Stimpfle [this message]
2014-11-12 18:25 ` [PATCH] git-send-email.perl: Fix handling of suppresscc option Junio C Hamano
2014-11-13 11:41   ` Jens Stimpfle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415801891-28471-1-git-send-email-debian@jstimpfle.de \
    --to=debian@jstimpfle.de \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).