{"thread":{"id":"39429","subject":"[PATCH v6] send-email: Add sendmail email aliases format","startedAt":"2015-05-26T21:32:03Z","lastAt":"2015-05-27T20:08:39Z","messageCount":2,"participants":["Allen Hubbe","Junio C Hamano"],"isPatch":true,"patchVersion":6,"patchTotal":null},"messages":[{"id":"262161","messageId":"950e3a77f09d62f77c9a40c843284b3686bdb7b0.1432675817.git.allenbh@gmail.com","threadId":"39429","inReplyTo":null,"subject":"[PATCH v6] send-email: Add sendmail email aliases format","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-05-26T21:32:03Z","receivedAt":"2015-05-26T21:32:03Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"Add support for the sendmail email aliases format.\n\nSynopsis:\n\n\t<alias>: <address|alias>[, <address|alias>...]\n\nExample:\n\n\talice: Alice W Land <awol@example.com>\n\tbob: Robert Bobbyton <bob@example.com>\n\t# this is a comment\n\t   # this is also a comment\n\tchloe: chloe@example.com\n\tabgroup: alice, bob\n\tbcgrp: bob, chloe, Other <o@example.com>\n\nQuoted aliases and quoted addresses are not supported.\n\nLine continuations are not supported.\n\nWarnings are printed for explicitly unsupported constructs, and any\nother lines that are not matched by the parser.\n\nSigned-off-by: Allen Hubbe <allenbh@gmail.com>\n---\n\nNotes:\n    This v6 makes the following changes from v5:\n    \n    * In the documentation:\n    ** Move 'sendmail' to the end of the list of formats.\n    ** Remove the description, synopsis, and example of sendmail aliases.\n    ** Specify exceptions to the sendmail format as a sub-definition.\n    ** Note: A general 'where to find documentation' paragraph will be added\n       by Junio, appearing either before or after this patch in the series.\n    * Changes to the parser:\n    ** Reword a comment to mention blank lines and comment lines.\n    ** Resolve inconsistent use of the keyword `next` by not using it.\n    ** Use non-greedy quantifier in the capture group for the alias name.\n    ** Use greedy quantifier in the capture group for email addresses.\n    * Changes to the test case:\n    ** Test alias input is written to the current dir, not the home dir.\n    ** Note: A fix to other tests to eliminate the use of tilde for the home\n       dir will be added by Junio, appearing either before or after this\n       patch in the series.\n\n Documentation/git-send-email.txt | 13 ++++++++++++-\n git-send-email.perl              | 25 +++++++++++++++++++++++++\n t/t9001-send-email.sh            | 27 +++++++++++++++++++++++++++\n 3 files changed, 64 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 804554609def..36fd0b86353c 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -383,7 +383,18 @@ sendemail.aliasesFile::\n \n sendemail.aliasFileType::\n \tFormat of the file(s) specified in sendemail.aliasesFile. Must be\n-\tone of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.\n+\tone of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus', or 'sendmail'.\n++\n+--\n+sendmail;;\n+*\tQuoted aliases and quoted addresses are not supported: lines that\n+\tcontain a `\"` symbol are ignored.\n+*\tLine continuations are not supported: lines that start with\n+\twhitespace characters, or end with a `\\` symbol are ignored.\n+*\tWarnings are printed on the standard error output for any\n+\texplicitly unsupported constructs, and any other lines that are not\n+\trecognized by the parser.\n+--\n \n sendemail.multiEdit::\n \tIf true (default), a single editor instance will be spawned to edit\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex e1e9b1460ced..6bedf745e72d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -516,6 +516,31 @@ my %parse_alias = (\n \t\t\t  }\n \t\t      } },\n \n+\tsendmail => sub { my $fh = shift; while (<$fh>) {\n+\t\t# ignore blank lines and comment lines\n+\t\tif (/^\\s*(?:#.*)?$/) { }\n+\n+\t\t# warn on lines that contain quotes\n+\t\telsif (/\"/) {\n+\t\t\tprint STDERR \"sendmail alias with quotes is not supported: $_\\n\";\n+\t\t}\n+\n+\t\t# warn on lines that continue\n+\t\telsif (/^\\s|\\\\$/) {\n+\t\t\tprint STDERR \"sendmail continuation line is not supported: $_\\n\";\n+\t\t}\n+\n+\t\t# recognize lines that look like an alias\n+\t\telsif (/^(\\S+?)\\s*:\\s*(.+)$/) {\n+\t\t\tmy ($alias, $addr) = ($1, $2);\n+\t\t\t$aliases{$alias} = [ split_addrs($addr) ];\n+\t\t}\n+\n+\t\t# warn on lines that are not recognized\n+\t\telse {\n+\t\t\tprint STDERR \"sendmail line is not recognized: $_\\n\";\n+\t\t}}},\n+\n \tgnus => sub { my $fh = shift; while (<$fh>) {\n \t\tif (/\\(define-mail-alias\\s+\"(\\S+?)\"\\s+\"(\\S+?)\"\\)/) {\n \t\t\t$aliases{$1} = [ $2 ];\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 7be14a4e37f7..01c7ef4d9b67 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1549,6 +1549,33 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n \n+test_expect_success $PREREQ 'sendemail.aliasfiletype=sendmail' '\n+\tclean_fake_sendmail && rm -fr outdir &&\n+\tgit format-patch -1 -o outdir &&\n+\tcat >>.tmp-email-aliases <<-\\EOF &&\n+\talice: Alice W Land <awol@example.com>\n+\tbob: Robert Bobbyton <bob@example.com>\n+\t# this is a comment\n+\t   # this is also a comment\n+\tchloe: chloe@example.com\n+\tabgroup: alice, bob\n+\tbcgrp: bob, chloe, Other <o@example.com>\n+\tEOF\n+\tgit config --replace-all sendemail.aliasesfile \\\n+\t\t\"$(pwd)/.tmp-email-aliases\" &&\n+\tgit config sendemail.aliasfiletype sendmail &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--to=alice --to=bcgrp \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\toutdir/0001-*.patch \\\n+\t\t2>errors >out &&\n+\tgrep \"^!awol@example\\.com!$\" commandline1 &&\n+\tgrep \"^!bob@example\\.com!$\" commandline1 &&\n+\tgrep \"^!chloe@example\\.com!$\" commandline1 &&\n+\tgrep \"^!o@example\\.com!$\" commandline1\n+'\n+\n do_xmailer_test () {\n \texpected=$1 params=$2 &&\n \tgit format-patch -1 &&\n-- \n2.3.4\n"},{"id":"262259","messageId":"xmqqbnh5lr5k.fsf@gitster.dls.corp.google.com","threadId":"39429","inReplyTo":"950e3a77f09d62f77c9a40c843284b3686bdb7b0.1432675817.git.allenbh@gmail.com","subject":"Re: [PATCH v6] send-email: Add sendmail email aliases format","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-27T20:08:39Z","receivedAt":"2015-05-27T20:08:39Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Allen Hubbe <allenbh@gmail.com> writes:\n\n> Add support for the sendmail email aliases format.\n\nThanks.\n\n>     ** Note: A general 'where to find documentation' paragraph will be added\n>        by Junio, appearing either before or after this patch in the series.\n\nYou didn't have to do this to me; as long as you agree with me that\nthe paragraph is a good thing to have, it is OK (and even more\npreferable) to include it in this patch.\n\nThat's called collaboration.\n\nIf other person's contribution was really significant and the change\ncan stand on its own, then a split two-patch series with the author\nset to the other person may not be a bad idea, and if other person's\ncontribution was really significant but the change by the other\nperson cannot stand on its own, \"Helped-by\" in the log message would\nbe sufficient.  My contribution in this case is much less than that.\n\n>     ** Note: A fix to other tests to eliminate the use of tilde for the home\n>        dir will be added by Junio, appearing either before or after this\n>        patch in the series.\n\nThat is a sensible thing to do, as it does not relate to this\nchange.\n\nThanks.  Will queue and let's start merging this topic to 'next' and\ndown.\n"}]}