git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: git@vger.kernel.org
Cc: Jay Soffian <jaysoffian@gmail.com>,
	Ryan Anderson <ryan@michonline.com>,
	gitster@pobox.com, Thomas Rast <trast@student.ethz.ch>,
	Jeff King <peff@peff.net>
Subject: [PATCH 1/3 v2] send-email: correct logic error with --suppress-cc=cc
Date: Sat, 14 Feb 2009 01:21:59 -0500	[thread overview]
Message-ID: <1234592519-71980-1-git-send-email-jaysoffian@gmail.com> (raw)
In-Reply-To: <1234583491-61260-2-git-send-email-jaysoffian@gmail.com>

--suppress-cc=cc is supposed to suppress harvesting addresses from any
Cc: lines. However, in the case where the Cc: line contained the sender,
it would only suppress if --suppress-cc=self.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
---
And here's a re-roll of this one. Sheesh, that logic was too subtle for
my brain. I think it's a lot more obvious what is going on after this
patch.

I apologize that this thread is getting so dense. Here it is on gmane
which may help:

  http://thread.gmane.org/gmane.comp.version-control.git/109783

j.

 git-send-email.perl |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index cde294c..cef32da 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -959,18 +959,17 @@ foreach my $t (@files) {
 			}
 			elsif (/^From:\s+(.*)$/) {
 				($author, $author_encoding) = unquote_rfc2047($1);
-				next if ($suppress_cc{'author'});
+				next if $suppress_cc{'author'};
+				next if $suppress_cc{'self'} and $author eq $sender;
 				printf("(mbox) Adding cc: %s from line '%s'\n",
 					$1, $_) unless $quiet;
 				push @cc, $1;
 			}
 			elsif (/^Cc:\s+(.*)$/) {
+				next if $suppress_cc{'cc'};
 				foreach my $addr (parse_address_line($1)) {
-					if (unquote_rfc2047($addr) eq $sender) {
-						next if ($suppress_cc{'self'});
-					} else {
-						next if ($suppress_cc{'cc'});
-					}
+					next if $suppress_cc{'self'} and
+						unquote_rfc2047($addr) eq $sender;
 					printf("(mbox) Adding cc: %s from line '%s'\n",
 						$addr, $_) unless $quiet;
 					push @cc, $addr;
@@ -1038,7 +1037,7 @@ foreach my $t (@files) {
 			or die "(cc-cmd) failed to close pipe to '$cc_cmd'";
 	}
 
-	if (defined $author) {
+	if (defined $author and $author ne $sender) {
 		$message = "From: $author\n\n$message";
 		if (defined $author_encoding) {
 			if ($has_content_type) {
-- 
1.6.2.rc0.238.g0c1fe

  reply	other threads:[~2009-02-14  6:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-13 23:05 [PATCH] send-email: handle multiple Cc addresses when reading mbox message Jay Soffian
2009-02-13 23:32 ` Thomas Rast
2009-02-13 23:39   ` Jay Soffian
2009-02-13 23:44     ` Jay Soffian
2009-02-14  3:51   ` Jay Soffian
2009-02-14 16:57     ` Thomas Rast
2009-02-14  3:51   ` [PATCH 1/3] send-email: correct logic error with --suppress-cc=cc Jay Soffian
2009-02-14  6:21     ` Jay Soffian [this message]
2009-02-14  6:52       ` [PATCH 1/3 v2] " Junio C Hamano
2009-02-14  7:15         ` Jay Soffian
2009-02-14  7:35           ` Junio C Hamano
2009-02-14  3:51   ` [PATCH 2/3] send-email: don't call unquote_rfc2047 unnecessarily Jay Soffian
2009-02-14  5:50     ` Jay Soffian
2009-02-14  3:51   ` [PATCH 3/3] send-email: --suppress-cc improvements Jay Soffian
2009-02-14  5:37     ` [PATCH 3/3 v2] " Jay Soffian
2009-02-14  6:36       ` Junio C Hamano
2009-02-14 17:06         ` [PATCH v3] " Thomas Rast
2009-02-14 17:06           ` [Interdiff " Thomas Rast
2009-02-14 22:21           ` [PATCH " Thomas Rast
2009-02-15 10:47             ` Junio C Hamano
2009-02-14  0:31 ` [PATCH] send-email: handle multiple Cc addresses when reading mbox message Jeff King
2009-02-14  0:42   ` Jay Soffian
2009-02-14  3:37     ` Jeff King
2009-02-14  8:16     ` Junio C Hamano

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=1234592519-71980-1-git-send-email-jaysoffian@gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=ryan@michonline.com \
    --cc=trast@student.ethz.ch \
    /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).