{"thread":{"id":"39544","subject":"[PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test","startedAt":"2015-06-06T16:59:32Z","lastAt":"2015-06-08T22:12:11Z","messageCount":11,"participants":["Remi Lespinet","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":5},"messages":[{"id":"263114","messageId":"1433609976-1868-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":null,"subject":"[PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-06T16:59:32Z","receivedAt":"2015-06-06T16:59:32Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Move the creation of the scripts used in to-cmd and cc-cmd tests\nin a setup test to make them available for later tests.\n\nThis will be used in the next commit.\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\n t/t9001-send-email.sh | 15 +++++++++------\n 1 file changed, 9 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 7be14a4..e63fc83 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email'\n \t)\n '\n \n+test_expect_success $PREREQ 'setup tocmd and cccmd scripts' '\n+\twrite_script tocmd-sed <<-\\EOF &&\n+\tsed -n -e \"s/^tocmd--//p\" \"$1\"\n+\tEOF\n+\twrite_script cccmd-sed <<-\\EOF\n+\tsed -n -e \"s/^cccmd--//p\" \"$1\"\n+\tEOF\n+'\n+\n test_expect_success $PREREQ 'tocmd works' '\n \tclean_fake_sendmail &&\n \tcp $patches tocmd.patch &&\n \techo tocmd--tocmd@example.com >>tocmd.patch &&\n-\twrite_script tocmd-sed <<-\\EOF &&\n-\tsed -n -e \"s/^tocmd--//p\" \"$1\"\n-\tEOF\n \tgit send-email \\\n \t\t--from=\"Example <nobody@example.com>\" \\\n \t\t--to-cmd=./tocmd-sed \\\n@@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' '\n \tclean_fake_sendmail &&\n \tcp $patches cccmd.patch &&\n \techo \"cccmd--  cccmd@example.com\" >>cccmd.patch &&\n-\twrite_script cccmd-sed <<-\\EOF &&\n-\tsed -n -e \"s/^cccmd--//p\" \"$1\"\n-\tEOF\n \tgit send-email \\\n \t\t--from=\"Example <nobody@example.com>\" \\\n \t\t--to=nobody@example.com \\\n-- \n1.9.1\n"},{"id":"263116","messageId":"1433609976-1868-2-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"1433609976-1868-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"[PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-06T16:59:33Z","receivedAt":"2015-06-06T16:59:33Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Interpret aliases in:\n\n  -  Header fields of patches generated by git format-patch\n     (using --to, --cc, --add-header for example) or\n     manually modified. Example of fields in header:\n\n      To: alias1\n      Cc: alias2\n      Cc: alias3\n\n  -  Outputs of command scripts specified by --cc-cmd and\n     --to-cmd. Example of script:\n\n      #!/bin/sh\n      echo alias1\n      echo alias2\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n\n---\nNote that the --from option of git format-patch takes an argument which\nmust be formated as .*<.*> (if not, git format-patch will be aborted with\nfatal: invalid ident line). For this reason, passing an alias as an\nargument of --from is not possible, but modifying the from field in\nthe patch manually is.\n\n git-send-email.perl   |  2 ++\n t/t9001-send-email.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 62 insertions(+)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex e1e9b14..0cac4b0 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1535,7 +1535,9 @@ foreach my $t (@files) {\n \t\t($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));\n \t$needs_confirm = \"inform\" if ($needs_confirm && $confirm_unconfigured && @cc);\n \n+\t@to = expand_aliases(@to);\n \t@to = validate_address_list(sanitize_address_list(@to));\n+\t@cc = expand_aliases(@cc);\n \t@cc = validate_address_list(sanitize_address_list(@cc));\n \n \t@to = (@initial_to, @to);\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex e63fc83..062c703 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1552,6 +1552,66 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '\n \tgrep \"^!someone@example\\.org!$\" commandline1\n '\n \n+test_expect_success $PREREQ 'alias support in To header' '\n+\tclean_fake_sendmail &&\n+\techo \"alias sbd  someone@example.org\" >.mailrc &&\n+\ttest_config sendemail.aliasesfile \".mailrc\" &&\n+\ttest_config sendemail.aliasfiletype mailrc &&\n+\tgit format-patch --stdout -1 --to=sbd >aliased.patch &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\taliased.patch \\\n+\t\t2>errors >out &&\n+\tgrep \"^!someone@example\\.org!$\" commandline1\n+'\n+\n+test_expect_success $PREREQ 'alias support in Cc header' '\n+\tclean_fake_sendmail &&\n+\techo \"alias sbd  someone@example.org\" >.mailrc &&\n+\ttest_config sendemail.aliasesfile \".mailrc\" &&\n+\ttest_config sendemail.aliasfiletype mailrc &&\n+\tgit format-patch --stdout -1 --cc=sbd >aliased.patch &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\taliased.patch \\\n+\t\t2>errors >out &&\n+\tgrep \"^!someone@example\\.org!$\" commandline1\n+'\n+\n+test_expect_success $PREREQ 'tocmd works with aliases' '\n+\tclean_fake_sendmail &&\n+\techo \"alias sbd  someone@example.org\" >.mailrc &&\n+\ttest_config sendemail.aliasesfile \".mailrc\" &&\n+\ttest_config sendemail.aliasfiletype mailrc &&\n+\tgit format-patch --stdout -1 >tocmd.patch &&\n+\techo tocmd--sbd >>tocmd.patch &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--to-cmd=./tocmd-sed \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\ttocmd.patch \\\n+\t\t2>errors >out &&\n+\tgrep \"^!someone@example\\.org!$\" commandline1\n+'\n+\n+test_expect_success $PREREQ 'cccmd works with aliases' '\n+\tclean_fake_sendmail &&\n+\techo \"alias sbd  someone@example.org\" >.mailrc &&\n+\ttest_config sendemail.aliasesfile \".mailrc\" &&\n+\ttest_config sendemail.aliasfiletype mailrc &&\n+\tgit format-patch --stdout -1 >cccmd.patch &&\n+\techo cccmd--sbd >>cccmd.patch &&\n+\tgit send-email \\\n+\t\t--from=\"Example <nobody@example.com>\" \\\n+\t\t--cc-cmd=./cccmd-sed \\\n+\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n+\t\tcccmd.patch \\\n+\t\t2>errors >out &&\n+\tgrep \"^!someone@example\\.org!$\" commandline1\n+'\n+\n do_xmailer_test () {\n \texpected=$1 params=$2 &&\n \tgit format-patch -1 &&\n-- \n1.9.1\n"},{"id":"263115","messageId":"1433609976-1868-3-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"1433609976-1868-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"[PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-06T16:59:34Z","receivedAt":"2015-06-06T16:59:34Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Create a function which replaces Date, Message-Id and\nX-Mailer lines generated by git-send-email by a specific string\n\nDate:.*$       -> Date: DATE-STRING\nMessage-Id:.*$ -> Message-Id: MESSAGE-ID-STRING\nX-Mailer:.*$   -> X-Mailer: X-MAILER-STRING\n\nThis is a preparatory for the next commit.\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\n t/t9001-send-email.sh | 11 +++++++----\n 1 file changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 062c703..806f066 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -522,6 +522,12 @@ Result: OK\n EOF\n \"\n \n+replace_variable_fields () {\n+\tsed\t-e \"s/^\\(Date:\\).*/\\1 DATE-STRING/\" \\\n+\t\t-e \"s/^\\(Message-Id:\\).*/\\1 MESSAGE-ID-STRING/\" \\\n+\t\t-e \"s/^\\(X-Mailer:\\).*/\\1 X-MAILER-STRING/\"\n+}\n+\n test_suppression () {\n \tgit send-email \\\n \t\t--dry-run \\\n@@ -529,10 +535,7 @@ test_suppression () {\n \t\t--from=\"Example <from@example.com>\" \\\n \t\t--to=to@example.com \\\n \t\t--smtp-server relay.example.com \\\n-\t\t$patches |\n-\tsed\t-e \"s/^\\(Date:\\).*/\\1 DATE-STRING/\" \\\n-\t\t-e \"s/^\\(Message-Id:\\).*/\\1 MESSAGE-ID-STRING/\" \\\n-\t\t-e \"s/^\\(X-Mailer:\\).*/\\1 X-MAILER-STRING/\" \\\n+\t\t$patches | replace_variable_fields \\\n \t\t>actual-suppress-$1${2+\"-$2\"} &&\n \ttest_cmp expected-suppress-$1${2+\"-$2\"} actual-suppress-$1${2+\"-$2\"}\n }\n-- \n1.9.1\n"},{"id":"263117","messageId":"1433609976-1868-4-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"1433609976-1868-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"[PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-06T16:59:35Z","receivedAt":"2015-06-06T16:59:35Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"From: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>\n\nAccept a list of emails separated by commas in flags --cc, --to and\n--bcc.  Multiple addresses can already be given by using these options\nmultiple times, but it is more convenient to allow cutting-and-pasting\na list of addresses from the header of an existing e-mail message,\nwhich already lists them as comma-separated list, as a value to a\nsingle parameter.\n\nThe following format can now be used:\n\n    $ git send-email --to='Jane <jdoe@example.com>, mike@example.com'\n\nHowever format using commas in names doesn't work:\n\n    $ git send-email --to='\"Jane, Doe\" <jdoe@example.com>'\n\nRemove the limitation imposed by 79ee555b (Check and document the\noptions to prevent mistakes, 2006-06-21) which rejected every argument\nwith comma in --cc, --to and --bcc.\n\nHelped-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\nSigned-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>\nSigned-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>\nSigned-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\n I've added a test using aliases in an email-list, that's why I\n kept the expected test (instead of grouping it with the test \"use\n email list in --cc --to and --bcc\" as suggested in the previous\n RFC).\n Maybe it is better to delete the \"use email list in --cc --to\n and --bcc\" and group the two other in a single test ?\n\n Documentation/git-send-email.txt | 21 +++++++++++++------\n git-send-email.perl              | 23 ++++++++-------------\n t/t9001-send-email.sh            | 44 ++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 68 insertions(+), 20 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 8045546..0146164 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -49,17 +49,23 @@ Composing\n \tof 'sendemail.annotate'. See the CONFIGURATION section for\n \t'sendemail.multiEdit'.\n \n---bcc=<address>::\n+--bcc=<address>,...::\n \tSpecify a \"Bcc:\" value for each email. Default is the value of\n \t'sendemail.bcc'.\n +\n-The --bcc option must be repeated for each user you want on the bcc list.\n+Addresses containing commas (\"Doe, Jane\" <foobar@example.com>) are not\n+currently supported.\n++\n+This option may be specified multiple times.\n \n---cc=<address>::\n+--cc=<address>,...::\n \tSpecify a starting \"Cc:\" value for each email.\n \tDefault is the value of 'sendemail.cc'.\n +\n-The --cc option must be repeated for each user you want on the cc list.\n+Addresses containing commas (\"Doe, Jane\" <foobar@example.com>) are not\n+currently supported.\n++\n+This option may be specified multiple times.\n \n --compose::\n \tInvoke a text editor (see GIT_EDITOR in linkgit:git-var[1])\n@@ -110,13 +116,16 @@ is not set, this will be prompted for.\n \tOnly necessary if --compose is also set.  If --compose\n \tis not set, this will be prompted for.\n \n---to=<address>::\n+--to=<address>,...::\n \tSpecify the primary recipient of the emails generated. Generally, this\n \twill be the upstream maintainer of the project involved. Default is the\n \tvalue of the 'sendemail.to' configuration value; if that is unspecified,\n \tand --to-cmd is not specified, this will be prompted for.\n +\n-The --to option must be repeated for each user you want on the to list.\n+Addresses containing commas (\"Doe, Jane\" <foobar@example.com>) are not\n+currently supported.\n++\n+This option may be specified multiple times.\n \n --8bit-encoding=<encoding>::\n \tWhen encountering a non-ASCII message or subject that does not\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 0cac4b0..4bc489d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter);\n ($repoauthor) = Git::ident_person(@repo, 'author');\n ($repocommitter) = Git::ident_person(@repo, 'committer');\n \n-# Verify the user input\n-\n-foreach my $entry (@initial_to) {\n-\tdie \"Comma in --to entry: $entry'\\n\" unless $entry !~ m/,/;\n-}\n-\n-foreach my $entry (@initial_cc) {\n-\tdie \"Comma in --cc entry: $entry'\\n\" unless $entry !~ m/,/;\n-}\n-\n-foreach my $entry (@bcclist) {\n-\tdie \"Comma in --bcclist entry: $entry'\\n\" unless $entry !~ m/,/;\n-}\n-\n sub parse_address_line {\n \tif ($have_mail_address) {\n \t\treturn map { $_->format } Mail::Address->parse($_[0]);\n@@ -808,10 +794,13 @@ sub expand_one_alias {\n \treturn $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;\n }\n \n+@initial_to = split_at_commas(@initial_to);\n @initial_to = expand_aliases(@initial_to);\n @initial_to = validate_address_list(sanitize_address_list(@initial_to));\n+@initial_cc = split_at_commas(@initial_cc);\n @initial_cc = expand_aliases(@initial_cc);\n @initial_cc = validate_address_list(sanitize_address_list(@initial_cc));\n+@bcclist = split_at_commas(@bcclist);\n @bcclist = expand_aliases(@bcclist);\n @bcclist = validate_address_list(sanitize_address_list(@bcclist));\n \n@@ -1026,6 +1015,10 @@ sub sanitize_address_list {\n \treturn (map { sanitize_address($_) } @_);\n }\n \n+sub split_at_commas {\n+\treturn (map { split /\\s*,\\s*/, $_ } @_);\n+}\n+\n # Returns the local Fully Qualified Domain Name (FQDN) if available.\n #\n # Tightly configured MTAa require that a caller sends a real DNS\n@@ -1535,8 +1528,10 @@ foreach my $t (@files) {\n \t\t($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));\n \t$needs_confirm = \"inform\" if ($needs_confirm && $confirm_unconfigured && @cc);\n \n+\t@to = split_at_commas(@to);\n \t@to = expand_aliases(@to);\n \t@to = validate_address_list(sanitize_address_list(@to));\n+\t@cc = split_at_commas(@cc);\n \t@cc = expand_aliases(@cc);\n \t@cc = validate_address_list(sanitize_address_list(@cc));\n \ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 806f066..9aee474 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1648,4 +1648,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '\n \tdo_xmailer_test 1 \"--xmailer\"\n '\n \n+test_expect_success $PREREQ 'setup expected-list' '\n+\tgit send-email \\\n+\t--dry-run \\\n+\t--from=\"Example <from@example.com>\" \\\n+\t--to=\"To 1 <to1@example.com>\" \\\n+\t--to=\"to2@example.com\" \\\n+\t--to=\"to3@example.com\" \\\n+\t--cc=\"Cc 1 <cc1@example.com>\" \\\n+\t--cc=\"Cc2 <cc2@example.com>\" \\\n+\t--bcc=\"bcc1@example.com\" \\\n+\t--bcc=\"bcc2@example.com\" \\\n+\t0001-add-master.patch | replace_variable_fields \\\n+\t>expected-list\n+'\n+\n+test_expect_success $PREREQ 'use email list in --cc --to and --bcc' '\n+\tgit send-email \\\n+\t--dry-run \\\n+\t--from=\"Example <from@example.com>\" \\\n+\t--to=\"To 1 <to1@example.com>, to2@example.com\" \\\n+\t--to=\"to3@example.com\" \\\n+\t--cc=\"Cc 1 <cc1@example.com>, Cc2 <cc2@example.com>\" \\\n+\t--bcc=\"bcc1@example.com, bcc2@example.com\" \\\n+\t0001-add-master.patch | replace_variable_fields \\\n+\t>actual-list &&\n+\ttest_cmp expected-list actual-list\n+'\n+\n+test_expect_success $PREREQ 'aliases work with email list' '\n+\techo \"alias to2 to2@example.com\" >.mutt &&\n+\techo \"alias cc1 Cc 1 <cc1@example.com>\" >>.mutt &&\n+\ttest_config sendemail.aliasesfile \".mutt\" &&\n+\ttest_config sendemail.aliasfiletype mutt &&\n+\tgit send-email \\\n+\t--dry-run \\\n+\t--from=\"Example <from@example.com>\" \\\n+\t--to=\"To 1 <to1@example.com>, to2, to3@example.com\" \\\n+\t--cc=\"cc1, Cc2 <cc2@example.com>\" \\\n+\t--bcc=\"bcc1@example.com, bcc2@example.com\" \\\n+\t0001-add-master.patch | replace_variable_fields \\\n+\t>actual-list &&\n+\ttest_cmp expected-list actual-list\n+'\n+\n test_done\n-- \n1.9.1\n"},{"id":"263118","messageId":"1433609976-1868-5-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"1433609976-1868-1-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"[PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-06T16:59:36Z","receivedAt":"2015-06-06T16:59:36Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Simplify code by creating a function to transform list of email lists\n(comma separated, with aliases ...)  into a simple list of valid email\naddresses.\n\nSigned-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>\n---\n I'm not sure about the name of the function...\n\n git-send-email.perl | 28 +++++++++++++---------------\n 1 file changed, 13 insertions(+), 15 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 4bc489d..ea03308 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -794,15 +794,9 @@ sub expand_one_alias {\n \treturn $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;\n }\n \n-@initial_to = split_at_commas(@initial_to);\n-@initial_to = expand_aliases(@initial_to);\n-@initial_to = validate_address_list(sanitize_address_list(@initial_to));\n+@initial_to = process_address_list(@initial_to);\n-@initial_cc = split_at_commas(@initial_cc);\n-@initial_cc = expand_aliases(@initial_cc);\n-@initial_cc = validate_address_list(sanitize_address_list(@initial_cc));\n+@initial_cc = process_address_list(@initial_cc);\n-@bcclist = split_at_commas(@bcclist);\n-@bcclist = expand_aliases(@bcclist);\n-@bcclist = validate_address_list(sanitize_address_list(@bcclist));\n+@bcclist = process_address_list(@bcclist);\n \n if ($thread && !defined $initial_reply_to && $prompting) {\n \t$initial_reply_to = ask(\n@@ -1019,6 +1013,14 @@ sub split_at_commas {\n \treturn (map { split /\\s*,\\s*/, $_ } @_);\n }\n \n+sub process_address_list {\n+    my @addr_list = split_at_commas(@_);\n+    @addr_list = expand_aliases(@addr_list);\n+    @addr_list = sanitize_address_list(@addr_list);\n+    @addr_list = validate_address_list(@addr_list);\n+    return @addr_list;\n+}\n+\n # Returns the local Fully Qualified Domain Name (FQDN) if available.\n #\n # Tightly configured MTAa require that a caller sends a real DNS\n@@ -1528,12 +1530,8 @@ foreach my $t (@files) {\n \t\t($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));\n \t$needs_confirm = \"inform\" if ($needs_confirm && $confirm_unconfigured && @cc);\n \n-\t@to = split_at_commas(@to);\n-\t@to = expand_aliases(@to);\n-\t@to = validate_address_list(sanitize_address_list(@to));\n+\t@to = process_address_list(@to);\n-\t@cc = split_at_commas(@cc);\n-\t@cc = expand_aliases(@cc);\n-\t@cc = validate_address_list(sanitize_address_list(@cc));\n+\t@cc = process_address_list(@cc);\n \n \t@to = (@initial_to, @to);\n \t@cc = (@initial_cc, @cc);\n-- \n1.9.1\n"},{"id":"263210","messageId":"vpqk2ve9tfm.fsf@anie.imag.fr","threadId":"39544","inReplyTo":"1433609976-1868-5-git-send-email-remi.lespinet@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-08T14:16:29Z","receivedAt":"2015-06-08T14:16:29Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n\n> Simplify code by creating a function to transform list of email lists\n> (comma separated, with aliases ...)  into a simple list of valid email\n> addresses.\n\nI would have found the series easier to read if this refactoring came\nearlier (and then PATCH 2/5 would fix the bug as a positive side effect\nof the refactoring). I think it's too late to change this, though.\n\n>  I'm not sure about the name of the function...\n\nprocess_address_list() sounds good to me.\n\nThe whole series looks good to me now.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"263239","messageId":"1247043051.275297.1433780082550.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"vpqk2ve9tfm.fsf@anie.imag.fr","subject":"[PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-08T16:14:42Z","receivedAt":"2015-06-08T16:14:42Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n> \n> > Simplify code by creating a function to transform list of email lists\n> > (comma separated, with aliases ...)  into a simple list of valid email\n> > addresses.\n> \n> I would have found the series easier to read if this refactoring came\n> earlier (and then PATCH 2/5 would fix the bug as a positive side effect\n> of the refactoring). I think it's too late to change this, though.\n\nWhy is it to late? I can still change it if necessary.\n\n> >  I'm not sure about the name of the function...\n> \n> process_address_list() sounds good to me.\n\nOk nice. :)\n\nThanks\n"},{"id":"263243","messageId":"vpqmw0a2mst.fsf@anie.imag.fr","threadId":"39544","inReplyTo":"1247043051.275297.1433780082550.JavaMail.zimbra@ensimag.grenoble-inp.fr","subject":"Re: [PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-06-08T16:21:38Z","receivedAt":"2015-06-08T16:21:38Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n>\n>> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n>> \n>> > Simplify code by creating a function to transform list of email lists\n>> > (comma separated, with aliases ...)  into a simple list of valid email\n>> > addresses.\n>> \n>> I would have found the series easier to read if this refactoring came\n>> earlier (and then PATCH 2/5 would fix the bug as a positive side effect\n>> of the refactoring). I think it's too late to change this, though.\n>\n> Why is it to late? I can still change it if necessary.\n\nTo me, the series is ready now, and I don't think re-rolling it would be\na good time investment. Plus, I spent time reviewing this series and\nwith my proposal I'd need to review a relatively different one.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"263270","messageId":"1154859541.277990.1433784991860.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"vpqmw0a2mst.fsf@anie.imag.fr","subject":"[PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-08T17:36:31Z","receivedAt":"2015-06-08T17:36:31Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> To me, the series is ready now, and I don't think re-rolling it would be\n> a good time investment. Plus, I spent time reviewing this series and\n> with my proposal I'd need to review a relatively different one.\n\nOk, thanks.\n"},{"id":"263281","messageId":"xmqq8ubuavze.fsf@gitster.dls.corp.google.com","threadId":"39544","inReplyTo":"vpqk2ve9tfm.fsf@anie.imag.fr","subject":"Re: [PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-08T18:36:05Z","receivedAt":"2015-06-08T18:36:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n>\n>> Simplify code by creating a function to transform list of email lists\n>> (comma separated, with aliases ...)  into a simple list of valid email\n>> addresses.\n>\n> I would have found the series easier to read if this refactoring came\n> earlier (and then PATCH 2/5 would fix the bug as a positive side effect\n> of the refactoring).\n\nI agree that doing 5/5 sooner would make 4/5 a lot clearer.  \n\nIntroducing the helper of 5/5 before 2/5 happens, and then replacing\ntwo calls to validate-address-list with process-address-list would\nhide the nature of the change, i.e. fixing a bug, so it is better to\nsee it done before the refactoring of 5/5, provided if it is indeed\na bug that these were not expanded.\n"},{"id":"263317","messageId":"415871115.284559.1433801531886.JavaMail.zimbra@ensimag.grenoble-inp.fr","threadId":"39544","inReplyTo":"xmqq8ubuavze.fsf@gitster.dls.corp.google.com","subject":"[PATCH/RFC v2 5/5] send-email: refactor address list process","fromName":"Remi Lespinet","fromEmail":"remi.lespinet@ensimag.grenoble-inp.fr","sentAt":"2015-06-08T22:12:11Z","receivedAt":"2015-06-08T22:12:11Z","isPatch":true,"sender":{"key":"remi.lespinet@ensimag.grenoble-inp.fr","avatar":"https://avatars.githubusercontent.com/u/11941160?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes\n\n> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n> \n> > Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:\n> >\n> >> Simplify code by creating a function to transform list of email lists\n> >> (comma separated, with aliases ...)  into a simple list of valid email\n> >> addresses.\n> >\n> > I would have found the series easier to read if this refactoring came\n> > earlier (and then PATCH 2/5 would fix the bug as a positive side effect\n> > of the refactoring).\n> \n> I agree that doing 5/5 sooner would make 4/5 a lot clearer.  \n> \n> Introducing the helper of 5/5 before 2/5 happens, and then replacing\n> two calls to validate-address-list with process-address-list would\n> hide the nature of the change, i.e. fixing a bug, so it is better to\n> see it done before the refactoring of 5/5, provided if it is indeed\n> a bug that these were not expanded.\n\nOk thanks, I submit it again soon. Also I think we should swap the\nlines 'sanitize_address_list(...)' and 'expand_aliases(...)',\ni.e. first sanitize addresses and then expand aliases.\n\nWe could then remove leading and trailing whitespaces in the\nsanitize_address_list function as aliases file formats supported by git\nsend-email doesn't take these whitespace into account anyway:\n\nExample which currently can't work:\n\ngit send-email --to=\" alias\" ...\n\nMoreover I think it's more natural to do that so.\n\nI'll do it right after the refactoring patch introducing\nprocess_address_list or maybe I should avoid changing this patch now ?\n"}]}