{"thread":{"id":"39405","subject":"[PATCH v3] send-email: Add simple email aliases format","startedAt":"2015-05-22T03:35:09Z","lastAt":"2015-05-22T03:37:48Z","messageCount":2,"participants":["Allen Hubbe"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"261876","messageId":"8bcd133c3595ee6c50dfc815c5901b32eb88d88b.1432265641.git.allenbh@gmail.com","threadId":"39405","inReplyTo":null,"subject":"[PATCH v3] send-email: Add simple email aliases format","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-05-22T03:35:09Z","receivedAt":"2015-05-22T03:35:09Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"This format is more simple than the other alias file formats, so it may\nbe preferred by some users.  The format is as follows.\n\n\t<alias>: <address|alias>[, <address|alias>...]\n\nAliases are specified one per line.  There is no line splitting.\nAnything on a line after and including a `#` symbol is considered a\ncomment, and is ignored.  Blank lines are ignored.\n\nExample of the 'simple' format:\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 # comment after an alias\n\tbcgrp: bob, chloe, Other <o@example.com>\n\nSigned-off-by: Allen Hubbe <allenbh@gmail.com>\n---\n\nNotes:\n    This v3 extends the syntax to allow blank lines, and comments.  The test\n    case is extended with comments added to alias file input.\n    \n    The Documentation/git-send-email.txt is updated with a description of\n    the simple format.  A note is added for the other formats, directing\n    readers to check the documentation of the email clients for a\n    description.\n\n Documentation/git-send-email.txt |  2 +-\n git-send-email.perl              |  6 +++++-\n t/t9001-send-email.sh            | 24 ++++++++++++++++++++++++\n 3 files changed, 30 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 804554609def..99583c4f8969 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -383,7 +383,7 @@ 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', 'gnus', or 'simple'.\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..25d72e8db8bf 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -515,7 +515,11 @@ my %parse_alias = (\n \t\t\t       $aliases{$alias} = [ split_addrs($addr) ];\n \t\t\t  }\n \t\t      } },\n-\n+\tsimple => sub { my $fh = shift; while (<$fh>) {\n+\t\tif (/^\\s*(\\S+)\\s*:\\s*(.+)$/) {\n+\t\t\tmy ($alias, $addr) = ($1, $2);\n+\t\t\t$aliases{$alias} = [ split_addrs($addr) ];\n+\t\t}}},\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..bbb73cdf8bec 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1548,6 +1548,30 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \t\t2>errors >out &&\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n+test_expect_success $PREREQ 'sendemail.aliasfiletype=simple' '\n+\tclean_fake_sendmail && rm -fr outdir &&\n+\tgit format-patch -1 -o outdir &&\n+\t{\n+\t\techo \"alice: Alice W Land <awol@example.com>\"\n+\t\techo \"bob: Robert Bobbyton <bob@example.com>\"\n+\t\techo \"chloe: chloe@example.com\"\n+\t\techo \"abgroup: alice, bob\"\n+\t\techo \"bcgrp: bob, chloe, Other <o@example.com>\"\n+\t} >~/.tmp-email-aliases &&\n+\tgit config --replace-all sendemail.aliasesfile \\\n+\t\t\"$(pwd)/.tmp-email-aliases\" &&\n+\tgit config sendemail.aliasfiletype simple &&\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-- \n2.3.4\n"},{"id":"261877","messageId":"CAJ80sasiGTLqcu4p7oFY5=xKfFeJvpKgGgvBiX1y0M8Ex+5+Ug@mail.gmail.com","threadId":"39405","inReplyTo":"8bcd133c3595ee6c50dfc815c5901b32eb88d88b.1432265641.git.allenbh@gmail.com","subject":"Re: [PATCH v3] send-email: Add simple email aliases format","fromName":"Allen Hubbe","fromEmail":"allenbh@gmail.com","sentAt":"2015-05-22T03:37:48Z","receivedAt":"2015-05-22T03:37:48Z","isPatch":true,"sender":{"key":"allenbh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/812915?v=4"},"body":"Please ignore v3... this is the same as v2 for some reason.  I will\nresend as v4.\n\nOn Thu, May 21, 2015 at 11:35 PM, Allen Hubbe <allenbh@gmail.com> wrote:\n> This format is more simple than the other alias file formats, so it may\n> be preferred by some users.  The format is as follows.\n>\n>         <alias>: <address|alias>[, <address|alias>...]\n>\n> Aliases are specified one per line.  There is no line splitting.\n> Anything on a line after and including a `#` symbol is considered a\n> comment, and is ignored.  Blank lines are ignored.\n>\n> Example of the 'simple' format:\n>\n>         alice: Alice W Land <awol@example.com>\n>         bob: Robert Bobbyton <bob@example.com>\n>         # this is a comment\n>            # this is also a comment\n>         chloe: chloe@example.com\n>         abgroup: alice, bob # comment after an alias\n>         bcgrp: bob, chloe, Other <o@example.com>\n>\n> Signed-off-by: Allen Hubbe <allenbh@gmail.com>\n> ---\n>\n> Notes:\n>     This v3 extends the syntax to allow blank lines, and comments.  The test\n>     case is extended with comments added to alias file input.\n>\n>     The Documentation/git-send-email.txt is updated with a description of\n>     the simple format.  A note is added for the other formats, directing\n>     readers to check the documentation of the email clients for a\n>     description.\n>\n>  Documentation/git-send-email.txt |  2 +-\n>  git-send-email.perl              |  6 +++++-\n>  t/t9001-send-email.sh            | 24 ++++++++++++++++++++++++\n>  3 files changed, 30 insertions(+), 2 deletions(-)\n>\n> diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\n> index 804554609def..99583c4f8969 100644\n> --- a/Documentation/git-send-email.txt\n> +++ b/Documentation/git-send-email.txt\n> @@ -383,7 +383,7 @@ sendemail.aliasesFile::\n>\n>  sendemail.aliasFileType::\n>         Format of the file(s) specified in sendemail.aliasesFile. Must be\n> -       one of 'mutt', 'mailrc', 'pine', 'elm', or 'gnus'.\n> +       one of 'mutt', 'mailrc', 'pine', 'elm', 'gnus', or 'simple'.\n>\n>  sendemail.multiEdit::\n>         If true (default), a single editor instance will be spawned to edit\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index e1e9b1460ced..25d72e8db8bf 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -515,7 +515,11 @@ my %parse_alias = (\n>                                $aliases{$alias} = [ split_addrs($addr) ];\n>                           }\n>                       } },\n> -\n> +       simple => sub { my $fh = shift; while (<$fh>) {\n> +               if (/^\\s*(\\S+)\\s*:\\s*(.+)$/) {\n> +                       my ($alias, $addr) = ($1, $2);\n> +                       $aliases{$alias} = [ split_addrs($addr) ];\n> +               }}},\n>         gnus => sub { my $fh = shift; while (<$fh>) {\n>                 if (/\\(define-mail-alias\\s+\"(\\S+?)\"\\s+\"(\\S+?)\"\\)/) {\n>                         $aliases{$1} = [ $2 ];\n> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\n> index 7be14a4e37f7..bbb73cdf8bec 100755\n> --- a/t/t9001-send-email.sh\n> +++ b/t/t9001-send-email.sh\n> @@ -1548,6 +1548,30 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n>                 2>errors >out &&\n>         grep \"^!someone@example\\.org!$\" commandline1\n>  '\n> +test_expect_success $PREREQ 'sendemail.aliasfiletype=simple' '\n> +       clean_fake_sendmail && rm -fr outdir &&\n> +       git format-patch -1 -o outdir &&\n> +       {\n> +               echo \"alice: Alice W Land <awol@example.com>\"\n> +               echo \"bob: Robert Bobbyton <bob@example.com>\"\n> +               echo \"chloe: chloe@example.com\"\n> +               echo \"abgroup: alice, bob\"\n> +               echo \"bcgrp: bob, chloe, Other <o@example.com>\"\n> +       } >~/.tmp-email-aliases &&\n> +       git config --replace-all sendemail.aliasesfile \\\n> +               \"$(pwd)/.tmp-email-aliases\" &&\n> +       git config sendemail.aliasfiletype simple &&\n> +       git send-email \\\n> +               --from=\"Example <nobody@example.com>\" \\\n> +               --to=alice --to=bcgrp \\\n> +               --smtp-server=\"$(pwd)/fake.sendmail\" \\\n> +               outdir/0001-*.patch \\\n> +               2>errors >out &&\n> +       grep \"^!awol@example\\.com!$\" commandline1 &&\n> +       grep \"^!bob@example\\.com!$\" commandline1 &&\n> +       grep \"^!chloe@example\\.com!$\" commandline1 &&\n> +       grep \"^!o@example\\.com!$\" commandline1\n> +'\n>\n>  do_xmailer_test () {\n>         expected=$1 params=$2 &&\n> --\n> 2.3.4\n>\n"}]}