summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorAllen Hubbe <allenbh@gmail.com>2015-05-26 17:32:03 -0400
committerJunio C Hamano <gitster@pobox.com>2015-05-27 13:01:48 -0700
commit3169e06daf297227362fb64a9d5c2cc451fefcbb (patch)
tree8b4b3893cec5fa76edcb16526c4df4986540adfb /git-send-email.perl
parent9532ead9875b7b92ff2007f9de61af5874e8839a (diff)
downloadgit-3169e06daf297227362fb64a9d5c2cc451fefcbb.tar.gz
send-email: add sendmail email aliases format
Teach send-email to read aliases in the sendmail aliases format, i.e. <alias>: <address|alias>[, <address|alias>...] Examples: alice: Alice W Land <awol@example.com> bob: Robert Bobbyton <bob@example.com> # this is a comment # this is also a comment chloe: chloe@example.com abgroup: alice, bob bcgrp: bob, chloe, Other <o@example.com> - Quoted aliases and quoted addresses are not supported. - Line continuations are not supported. Warnings are printed for explicitly unsupported constructs, and any other lines that are not matched by the parser. Signed-off-by: Allen Hubbe <allenbh@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl25
1 files changed, 25 insertions, 0 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b1460c..6bedf745e7 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -516,6 +516,31 @@ my %parse_alias = (
}
} },
+ sendmail => sub { my $fh = shift; while (<$fh>) {
+ # ignore blank lines and comment lines
+ if (/^\s*(?:#.*)?$/) { }
+
+ # warn on lines that contain quotes
+ elsif (/"/) {
+ print STDERR "sendmail alias with quotes is not supported: $_\n";
+ }
+
+ # warn on lines that continue
+ elsif (/^\s|\\$/) {
+ print STDERR "sendmail continuation line is not supported: $_\n";
+ }
+
+ # recognize lines that look like an alias
+ elsif (/^(\S+?)\s*:\s*(.+)$/) {
+ my ($alias, $addr) = ($1, $2);
+ $aliases{$alias} = [ split_addrs($addr) ];
+ }
+
+ # warn on lines that are not recognized
+ else {
+ print STDERR "sendmail line is not recognized: $_\n";
+ }}},
+
gnus => sub { my $fh = shift; while (<$fh>) {
if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) {
$aliases{$1} = [ $2 ];