Re: [RFC] git-send-email: do not double-escape quotes from mutt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Eric Wong <normalperson@xxxxxxxx> writes:
> 
> > -			 # commas delimit multiple addresses
> > -			$aliases{$alias} = [ split_addrs($addr) ];
> > +			# commas delimit multiple addresses
> > +			my @addr = split_addrs($addr);
> > +
> > +			# quotes may be escaped in the file,
> > +			# remove them if paired so we do not
> > +			# double-escape them later.
> > +			s/^\\"(.*)\\"/"$1"/g foreach @addr;
> > +			$aliases{$alias} = \@addr
> 
> Can one address have two or more double-quoted string pieces in it?
> If that is possible, (.*) above might want to become (.*?) or even
> ([^"]*) to make it less greedy, perhaps?

Yes.  Apparently it's possible to have a double-quote inside the name,
too.  mutt understands both of the following:

alias qn \"Q. N\\\"ame\" <qn@xxxxxxxxxxx>   # becomes "Q. N\"ame"
alias dq \"Dub O.\" \"Q\" <dq@xxxxxxxxxxx>  # becomes "Dub O. Q"

The "qn" case can be taken care of using a simpler replacement
on top my original RFC:

--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -530,7 +530,7 @@ my %parse_alias = (
 			# quotes may be escaped in the file,
 			# remove them if paired so we do not
 			# double-escape them later.
-			s/^\\"(.*?)\\"/"$1"/g foreach @addr;
+			s/\\"/"/g foreach @addr;
 			$aliases{$alias} = \@addr
 		}}},
 	mailrc => sub { my $fh = shift; while (<$fh>) {

But I'm not sure how to handle the "dq" case or if that even
happens in practice, as attempting to save an alias with "Dub O." "Q"
in the From: header, mutt shortens it to the expected \"Dub O. Q\"
without extra quotes.

Saving "qn" round trips, so the \\\" in the middle is preserved.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]