All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexey Shumkin <zapped@mail.ru>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] send-email: Honor multi-part email messages
Date: Wed, 21 Sep 2011 00:19:25 +0400	[thread overview]
Message-ID: <20110921001925.03a83d3a@zappedws> (raw)
In-Reply-To: <7v1uvb6mn9.fsf@alter.siamese.dyndns.org>

> Alexey Shumkin <zapped@mail.ru> writes:
> 
> > diff --git a/git-send-email.perl b/git-send-email.perl
> > index 98ab33a..1abf4a4 100755
> > --- a/git-send-email.perl
> > +++ b/git-send-email.perl
> > @@ -1403,12 +1403,17 @@ sub file_has_nonascii {
> >  
> >  sub body_or_subject_has_nonascii {
> >  	my $fn = shift;
> > +	my $multipart = 0;
> >  	open(my $fh, '<', $fn)
> >  		or die "unable to open $fn: $!\n";
> >  	while (my $line = <$fh>) {
> >  		last if $line =~ /^$/;
> > +		if ($line
> > =~ /^Content-Type:\s*multipart\/mixed.*$/) {
> > +			$multipart = 1;
> > +		}
> >  		return 1 if $line =~ /^Subject.*[^[:ascii:]]/;
> >  	}
> > +	return 0 if $multipart;
> 
> Looks as if you can lose the extra variable and return 0 immediately
> when you find a line with that Content-Type inside the loop.
Well, as I understand "current" algorithm:
1. It assumes that file is one-part email message
2. Function searches non-ASCII characters in Subject header
3. If none then it looks non-ASCII characters at message body

my changes are to skip looking at message body of a multi-part
message as it has parts with their own Content-Type headers

The said above in details:
1. To set flag when we meet Content-Type: multipart/mixed header
2. After we processed all headers and did not found non-ASCII characters
in a Subject we take a look at this flag and exit with 0
if it is a multi-part message

  reply	other threads:[~2011-09-20 20:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-20  8:29 [PATCH] send-email: Honor multi-part email messages Alexey Shumkin
2011-09-20 19:26 ` Junio C Hamano
2011-09-20 20:19   ` Alexey Shumkin [this message]
2013-01-24 10:38     ` Alexey Shumkin
2013-01-24 18:11       ` Junio C Hamano
2013-01-24 18:31         ` Shumkin Alexey
2013-01-24 19:11           ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2013-01-25 15:28 [PATCH resent] " Alexey Shumkin
2013-01-25 15:28 ` [PATCH] " Alexey Shumkin
2013-01-25 17:47   ` Krzysztof Mazur
2013-01-25 22:24     ` Jeff King
2011-09-16 22:32 Alexey Shumkin

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=20110921001925.03a83d3a@zappedws \
    --to=zapped@mail.ru \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.