git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Allen Hubbe <allenbh@gmail.com>
Date
May 21, 2015, 18:51 UTC
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.

<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>
---
 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
Next: Junio C Hamano
Message 1 of 8 in “git-send-email.perl: Add sendmail aliases support”
  1. git-send-email.perl: Add sendmail aliases supportAllen Hubbe, May 21, 2015
  2. Junio C HamanoMay 21, 2015
  3. Allen HubbeMay 21, 2015
  4. Eric SunshineMay 21, 2015
  5. Allen HubbeMay 21, 2015
  6. Junio C HamanoMay 21, 2015
  7. Allen HubbeMay 21, 2015
  8. Junio C HamanoMay 21, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.