git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-email: Honor multi-part email messages

From
Alexey Shumkin <zapped@mail.ru>
Date
Sep 20, 2011, 20:19 UTC
Message-ID
<20110921001925.03a83d3a@zappedws>
In-Reply-To
<7v1uvb6mn9.fsf@alter.siamese.dyndns.org>
Show 25 quoted lines
> 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
Previous: Junio C HamanoNext: Alexey Shumkin
Message 3 of 7 in “send-email: Honor multi-part email messages”
  1. send-email: Honor multi-part email messagesAlexey Shumkin, Sep 20, 2011
  2. Junio C HamanoSep 20, 2011
  3. Alexey ShumkinSep 20, 2011
  4. Alexey ShumkinJan 24, 2013
  5. Junio C HamanoJan 24, 2013
  6. Shumkin AlexeyJan 24, 2013
  7. Junio C HamanoJan 24, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.