* [PATCH] git-send-email: Don't set author_not_sender from Cc: lines
@ 2006-08-22 13:38 Haavard Skinnemoen
2006-08-23 1:34 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Haavard Skinnemoen @ 2006-08-22 13:38 UTC (permalink / raw)
To: git; +Cc: Haavard Skinnemoen, Junio C Hamano
When an mbox-style patch contains a Cc: line in the header,
git-send-email will check the address against the sender specified
on the command line. If they don't match, sender_not_author will
be set to the address obtained from the Cc line.
When this happens, git-send-email inserts a From: line at the
beginning of the message body with the address obtained from the
Cc line in the header, and the sender might be accused of forging
patch authors.
This patch fixes this by only updating sender_not_author when
processing From: lines, not when processing Cc: lines.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
This email was sent using git-send-email with the patch applied. Junio
was Cc'ed by editing the patch header -- let's see if it works...
git-send-email.perl | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/git-send-email.perl b/git-send-email.perl
index a83c7e9..0197454 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -506,7 +506,7 @@ foreach my $t (@files) {
if (/^Subject:\s+(.*)$/) {
$subject = $1;
- } elsif (/^(Cc|From):\s+(.*)$/) {
+ } elsif (/^(From):\s+(.*)$/) {
if ($2 eq $from) {
next if ($suppress_from);
}
@@ -516,8 +516,11 @@ foreach my $t (@files) {
printf("(mbox) Adding cc: %s from line '%s'\n",
$2, $_) unless $quiet;
push @cc, $2;
+ } elsif (/^(Cc):\s+(.*)$/) {
+ printf("(mbox) Adding cc: %s from line '%s'\n",
+ $2, $_) unless $quiet;
+ push @cc, $2;
}
-
} else {
# In the traditional
# "send lots of email" format,
--
1.4.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines
2006-08-22 13:38 [PATCH] git-send-email: Don't set author_not_sender from Cc: lines Haavard Skinnemoen
@ 2006-08-23 1:34 ` Junio C Hamano
2006-08-23 9:14 ` Haavard Skinnemoen
0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2006-08-23 1:34 UTC (permalink / raw)
To: Haavard Skinnemoen; +Cc: git
Haavard Skinnemoen <hskinnemoen@atmel.com> writes:
> When an mbox-style patch contains a Cc: line in the header,
> git-send-email will check the address against the sender specified
> on the command line. If they don't match, sender_not_author will
> be set to the address obtained from the Cc line.
> @@ -506,7 +506,7 @@ foreach my $t (@files) {
> if (/^Subject:\s+(.*)$/) {
> $subject = $1;
>
> - } elsif (/^(Cc|From):\s+(.*)$/) {
> + } elsif (/^(From):\s+(.*)$/) {
> if ($2 eq $from) {
> next if ($suppress_from);
> }
> @@ -516,8 +516,11 @@ foreach my $t (@files) {
> printf("(mbox) Adding cc: %s from line '%s'\n",
> $2, $_) unless $quiet;
> push @cc, $2;
> + } elsif (/^(Cc):\s+(.*)$/) {
> + printf("(mbox) Adding cc: %s from line '%s'\n",
> + $2, $_) unless $quiet;
> + push @cc, $2;
> }
> -
> } else {
> # In the traditional
> # "send lots of email" format,
The patch looks wrong. If your name is on CC: and you want to
suppress sending to yourself what happens?
How about doing something like this instead?
diff --git a/git-send-email.perl b/git-send-email.perl
index a83c7e9..8adb6b9 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -510,7 +510,7 @@ foreach my $t (@files) {
if ($2 eq $from) {
next if ($suppress_from);
}
- else {
+ elsif ($1 eq 'From') {
$author_not_sender = $2;
}
printf("(mbox) Adding cc: %s from line '%s'\n",
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] git-send-email: Don't set author_not_sender from Cc: lines
2006-08-23 1:34 ` Junio C Hamano
@ 2006-08-23 9:14 ` Haavard Skinnemoen
0 siblings, 0 replies; 3+ messages in thread
From: Haavard Skinnemoen @ 2006-08-23 9:14 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On Tue, 22 Aug 2006 18:34:16 -0700
Junio C Hamano <junkio@cox.net> wrote:
> The patch looks wrong. If your name is on CC: and you want to
> suppress sending to yourself what happens?
It will still send it to you, I guess. The documentation only mentions
what happens with From: lines, so I wasn't really sure what behaviour is
expected...
> How about doing something like this instead?
Yeah, that's probably better. I just tested it by sending a mail to
myself, and it doesn't append an extra From: line, so it solves the
problem as far as I'm concerned.
Haavard
> diff --git a/git-send-email.perl b/git-send-email.perl
> index a83c7e9..8adb6b9 100755
> --- a/git-send-email.perl
> +++ b/git-send-email.perl
> @@ -510,7 +510,7 @@ foreach my $t (@files) {
> if ($2 eq $from) {
> next if
> ($suppress_from); }
> - else {
> + elsif ($1 eq 'From') {
> $author_not_sender =
> $2; }
> printf("(mbox) Adding cc: %s
> from line '%s'\n",
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-08-23 9:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-22 13:38 [PATCH] git-send-email: Don't set author_not_sender from Cc: lines Haavard Skinnemoen
2006-08-23 1:34 ` Junio C Hamano
2006-08-23 9:14 ` Haavard Skinnemoen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox