summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Hubbe <allenbh@gmail.com>2015-05-21 14:51:40 -0400
committerJunio C Hamano <gitster@pobox.com>2015-05-21 13:07:14 -0700
commit50581f490694c38a4b5519aa187550cf6205a490 (patch)
tree58665f40d6d44ce901c33d23c365b265b40a7291
parent3d4a3ffe64162b45ae7c991fc60623ecb4678cfd (diff)
downloadgit-ah/send-email-postfix-alias.tar.gz
git-send-email.perl: Add sendmail aliases supportah/send-email-postfix-alias
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. <alias>: <address|alias>[, <address|alias>...] Example (no indent in aliases file): alice: Alice W Land <awol@example.com> bob: Robert Bobbyton <bob@example.com> chloe: chloe@example.com abgroup: alice, bob bcgrp: bob, chloe, Other <o@example.com> 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 <allenbh@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xgit-send-email.perl7
1 files changed, 6 insertions, 1 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b1460c..5f2ec0df27 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 ];