From: Allen Hubbe Date: Thu, 21 May 2015 18:51:40 GMT Subject: [PATCH] git-send-email.perl: Add sendmail aliases support Message-ID: <3f1091c3de6e4e62037bc3c84c69026e33ee9707.1432229888.git.allenbh@gmail.com> Support sendmail (and postfix) style email aliases in git-send-email. This is the format of /etc/mail/aliases, documented by `man 5 aliases`. The man page may be provided by sendmail or postfix on your system, or by another email service that uses the same configuration file. See also: http://www.postfix.org/aliases.5.html. This format is more simple than the other alias file formats, so it may be preferred by some users. The format is as follows. : [, ...] Example (no indent in aliases file): alice: Alice W Land bob: Robert Bobbyton chloe: chloe@example.com abgroup: alice, bob bcgrp: bob, chloe, Other This patch DOES NOT support line continuations as are described by the specification. Line continuations are indicated by either (or both) a trailing '\' on the line to be continued, or leading whitespace on the continuing line. This patch does not do anything with the trailing '\', and ignores lines starting with whitespace. This patch also ignores lines that starts with '#', comment character, and empty lines. Signed-off-by: Allen Hubbe --- git-send-email.perl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) ]; + }}}, gnus => sub { my $fh = shift; while (<$fh>) { if (/\(define-mail-alias\s+"(\S+?)"\s+"(\S+?)"\)/) { $aliases{$1} = [ $2 ]; -- 2.3.4