Re: [PATCH] git-send-email.perl: Add sendmail aliases support

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

 



Allen Hubbe <allenbh@xxxxxxxxx> 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.

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) ];
			}
		}
	},

Thanks.
--
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]