On Thu, May 21, 2015 at 4:19 PM, Junio C Hamano <gits...@pobox.com> wrote:
> Allen Hubbe <alle...@gmail.com> writes:
>
>> diff --git a/git-send-email.perl b/git-send-email.perl
>> index e1e9b14..5f2ec0d 100755
>> --- a/git-send-email.perl
>> +++ b/git-send-email.perl
>> @@ -515,7 +515,12 @@ my %parse_alias = (
>>                              $aliases{$alias} = [ split_addrs($addr) ];
>>                         }
>>                     } },
>> -
>> +     sendmail => sub { my $fh = shift; while (<$fh>) {
>> +             next if /^$|^#|^\s/;
>> +             if (/^(\S+)\s*:\s*(.*?)\\?$/) {
>> +                     my ($alias, $addr) = ($1, $2);
>> +                     $aliases{$alias} = [ split_addrs($addr) ];
>> +             }}},
>
> Let me unfold the line only to make commenting it easier.
>
>         sendmail => sub {
>                 my $fh = shift;
>                 while (<$fh>) {
>                         next if /^$|^#|^\s/;
>                         if (/^(\S+)\s*:\s*(.*?)\\?$/) {
>                                 my ($alias, $addr) = ($1, $2);
>                                 $aliases{$alias} = [ split_addrs($addr) ];
>                         }
>                 }
>         },
>
> It is probably OK to omit support for folded lines, but wouldn't it
> be easy enough to be a bit more helpful to give a warning when you
> find such lines in the input?  Otherwise you will leave the users
> wondering why some of their aliases work while others don't.

The diff doesn't show enough context to include this comment:

my %parse_alias = (
        # multiline formats can be supported in the future
...

I can't be sure the author's intent, but my interpretation is such.
The parsers do not support multiline, even though the format might
allow it by definition.  Another interpretation could be, no multiline
formats allowed, or, the first person to add a multiline format should
remove this comment.

I think the first interpretation is correct, because according to this
script, the mutt format also has continuation lines.  I didn't find a
more authoritative document in my quick search.

http://www.wizzu.com/mutt/checkalias.pl

I suppose at this point it is also worth mentioning that /etc/aliases
doesn't claim to support aliases of aliases, but does support
non-email-addresses like mail directories and pipes.  I don't think
most git users would try to send email directly to a pipe.

My motivation for this patch was not really to support the sendmail
aliases file directly.  The commit message may therefore be
misleading.  So, I could also rewrite the commit message to say
something like, "loosely based on" the sendmail aliases format, if the
exceptions to the format in the current message are not enough.
Really, I just prefer the simpler <alias>: <email|alias> syntax
instead of the ones for mutt, elm, etc, and that is why I wrote this
patch.

>
> Perhaps like this (this is not even an output from "diff" but typed
> in my MUA, so there may be typos---take it just as illustrating
> ideas)?
>
> That way, users can fold the input themselves and try again if they
> wanted to.  The warning _may_ have to be squelched after a few hits
> to keep the result usable, though.
>
>         sendmail => sub {
>                 my $fh = shift;
>                 while (<$fh>) {
> -                       next if /^$|^#|^\s/;
> -                       if (/^(\S+)\s*:\s*(.*?)\\?$/) {
> +                       next if /^$|^#/;
> +                       if (/^\s/ || /\\$/) {
> +                               print STDERR "$.: $_";
> +                               print STDERR "continuation lines in alias not 
> supported\n";
> +                               next;
> +                       }
> +                       if (/^(\S+)\s*:\s*(.*)$/) {
>                                 my ($alias, $addr) = ($1, $2);
>                                 $aliases{$alias} = [ split_addrs($addr) ];
>                         }
>                 }
>         },

That's interesting.  I'd like to hear a second opinion before I add
that.  It's a good idea, but none of the other parsing routines print
out messages.

>
> Thanks.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to