git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test
@ 2015-06-06 16:59 Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs Remi Lespinet
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-06 16:59 UTC (permalink / raw)
  To: git
  Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy

Move the creation of the scripts used in to-cmd and cc-cmd tests
in a setup test to make them available for later tests.

This will be used in the next commit.

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 t/t9001-send-email.sh | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 7be14a4..e63fc83 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -312,13 +312,19 @@ test_expect_success $PREREQ,!AUTOIDENT 'broken implicit ident aborts send-email'
 	)
 '
 
+test_expect_success $PREREQ 'setup tocmd and cccmd scripts' '
+	write_script tocmd-sed <<-\EOF &&
+	sed -n -e "s/^tocmd--//p" "$1"
+	EOF
+	write_script cccmd-sed <<-\EOF
+	sed -n -e "s/^cccmd--//p" "$1"
+	EOF
+'
+
 test_expect_success $PREREQ 'tocmd works' '
 	clean_fake_sendmail &&
 	cp $patches tocmd.patch &&
 	echo tocmd--tocmd@example.com >>tocmd.patch &&
-	write_script tocmd-sed <<-\EOF &&
-	sed -n -e "s/^tocmd--//p" "$1"
-	EOF
 	git send-email \
 		--from="Example <nobody@example.com>" \
 		--to-cmd=./tocmd-sed \
@@ -332,9 +338,6 @@ test_expect_success $PREREQ 'cccmd works' '
 	clean_fake_sendmail &&
 	cp $patches cccmd.patch &&
 	echo "cccmd--  cccmd@example.com" >>cccmd.patch &&
-	write_script cccmd-sed <<-\EOF &&
-	sed -n -e "s/^cccmd--//p" "$1"
-	EOF
 	git send-email \
 		--from="Example <nobody@example.com>" \
 		--to=nobody@example.com \
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs
  2015-06-06 16:59 [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test Remi Lespinet
@ 2015-06-06 16:59 ` Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement Remi Lespinet
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-06 16:59 UTC (permalink / raw)
  To: git
  Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy

Interpret aliases in:

  -  Header fields of patches generated by git format-patch
     (using --to, --cc, --add-header for example) or
     manually modified. Example of fields in header:

      To: alias1
      Cc: alias2
      Cc: alias3

  -  Outputs of command scripts specified by --cc-cmd and
     --to-cmd. Example of script:

      #!/bin/sh
      echo alias1
      echo alias2

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>

---
Note that the --from option of git format-patch takes an argument which
must be formated as .*<.*> (if not, git format-patch will be aborted with
fatal: invalid ident line). For this reason, passing an alias as an
argument of --from is not possible, but modifying the from field in
the patch manually is.

 git-send-email.perl   |  2 ++
 t/t9001-send-email.sh | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

diff --git a/git-send-email.perl b/git-send-email.perl
index e1e9b14..0cac4b0 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -1535,7 +1535,9 @@ foreach my $t (@files) {
 		($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
 	$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
 
+	@to = expand_aliases(@to);
 	@to = validate_address_list(sanitize_address_list(@to));
+	@cc = expand_aliases(@cc);
 	@cc = validate_address_list(sanitize_address_list(@cc));
 
 	@to = (@initial_to, @to);
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index e63fc83..062c703 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1552,6 +1552,66 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
 	grep "^!someone@example\.org!$" commandline1
 '
 
+test_expect_success $PREREQ 'alias support in To header' '
+	clean_fake_sendmail &&
+	echo "alias sbd  someone@example.org" >.mailrc &&
+	test_config sendemail.aliasesfile ".mailrc" &&
+	test_config sendemail.aliasfiletype mailrc &&
+	git format-patch --stdout -1 --to=sbd >aliased.patch &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		aliased.patch \
+		2>errors >out &&
+	grep "^!someone@example\.org!$" commandline1
+'
+
+test_expect_success $PREREQ 'alias support in Cc header' '
+	clean_fake_sendmail &&
+	echo "alias sbd  someone@example.org" >.mailrc &&
+	test_config sendemail.aliasesfile ".mailrc" &&
+	test_config sendemail.aliasfiletype mailrc &&
+	git format-patch --stdout -1 --cc=sbd >aliased.patch &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		aliased.patch \
+		2>errors >out &&
+	grep "^!someone@example\.org!$" commandline1
+'
+
+test_expect_success $PREREQ 'tocmd works with aliases' '
+	clean_fake_sendmail &&
+	echo "alias sbd  someone@example.org" >.mailrc &&
+	test_config sendemail.aliasesfile ".mailrc" &&
+	test_config sendemail.aliasfiletype mailrc &&
+	git format-patch --stdout -1 >tocmd.patch &&
+	echo tocmd--sbd >>tocmd.patch &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--to-cmd=./tocmd-sed \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		tocmd.patch \
+		2>errors >out &&
+	grep "^!someone@example\.org!$" commandline1
+'
+
+test_expect_success $PREREQ 'cccmd works with aliases' '
+	clean_fake_sendmail &&
+	echo "alias sbd  someone@example.org" >.mailrc &&
+	test_config sendemail.aliasesfile ".mailrc" &&
+	test_config sendemail.aliasfiletype mailrc &&
+	git format-patch --stdout -1 >cccmd.patch &&
+	echo cccmd--sbd >>cccmd.patch &&
+	git send-email \
+		--from="Example <nobody@example.com>" \
+		--cc-cmd=./cccmd-sed \
+		--smtp-server="$(pwd)/fake.sendmail" \
+		cccmd.patch \
+		2>errors >out &&
+	grep "^!someone@example\.org!$" commandline1
+'
+
 do_xmailer_test () {
 	expected=$1 params=$2 &&
 	git format-patch -1 &&
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement
  2015-06-06 16:59 [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs Remi Lespinet
@ 2015-06-06 16:59 ` Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 5/5] send-email: refactor address list process Remi Lespinet
  3 siblings, 0 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-06 16:59 UTC (permalink / raw)
  To: git
  Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy

Create a function which replaces Date, Message-Id and
X-Mailer lines generated by git-send-email by a specific string

Date:.*$       -> Date: DATE-STRING
Message-Id:.*$ -> Message-Id: MESSAGE-ID-STRING
X-Mailer:.*$   -> X-Mailer: X-MAILER-STRING

This is a preparatory for the next commit.

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 t/t9001-send-email.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 062c703..806f066 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -522,6 +522,12 @@ Result: OK
 EOF
 "
 
+replace_variable_fields () {
+	sed	-e "s/^\(Date:\).*/\1 DATE-STRING/" \
+		-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
+		-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/"
+}
+
 test_suppression () {
 	git send-email \
 		--dry-run \
@@ -529,10 +535,7 @@ test_suppression () {
 		--from="Example <from@example.com>" \
 		--to=to@example.com \
 		--smtp-server relay.example.com \
-		$patches |
-	sed	-e "s/^\(Date:\).*/\1 DATE-STRING/" \
-		-e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \
-		-e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \
+		$patches | replace_variable_fields \
 		>actual-suppress-$1${2+"-$2"} &&
 	test_cmp expected-suppress-$1${2+"-$2"} actual-suppress-$1${2+"-$2"}
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc
  2015-06-06 16:59 [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement Remi Lespinet
@ 2015-06-06 16:59 ` Remi Lespinet
  2015-06-06 16:59 ` [PATCH/RFC v2 5/5] send-email: refactor address list process Remi Lespinet
  3 siblings, 0 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-06 16:59 UTC (permalink / raw)
  To: git
  Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy,
	Jorge Juan Garcia Garcia, Mathieu Lienard--Mayor

From: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>

Accept a list of emails separated by commas in flags --cc, --to and
--bcc.  Multiple addresses can already be given by using these options
multiple times, but it is more convenient to allow cutting-and-pasting
a list of addresses from the header of an existing e-mail message,
which already lists them as comma-separated list, as a value to a
single parameter.

The following format can now be used:

    $ git send-email --to='Jane <jdoe@example.com>, mike@example.com'

However format using commas in names doesn't work:

    $ git send-email --to='"Jane, Doe" <jdoe@example.com>'

Remove the limitation imposed by 79ee555b (Check and document the
options to prevent mistakes, 2006-06-21) which rejected every argument
with comma in --cc, --to and --bcc.

Helped-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>
Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 I've added a test using aliases in an email-list, that's why I
 kept the expected test (instead of grouping it with the test "use
 email list in --cc --to and --bcc" as suggested in the previous
 RFC).
 Maybe it is better to delete the "use email list in --cc --to
 and --bcc" and group the two other in a single test ?

 Documentation/git-send-email.txt | 21 +++++++++++++------
 git-send-email.perl              | 23 ++++++++-------------
 t/t9001-send-email.sh            | 44 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 20 deletions(-)

diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt
index 8045546..0146164 100644
--- a/Documentation/git-send-email.txt
+++ b/Documentation/git-send-email.txt
@@ -49,17 +49,23 @@ Composing
 	of 'sendemail.annotate'. See the CONFIGURATION section for
 	'sendemail.multiEdit'.
 
---bcc=<address>::
+--bcc=<address>,...::
 	Specify a "Bcc:" value for each email. Default is the value of
 	'sendemail.bcc'.
 +
-The --bcc option must be repeated for each user you want on the bcc list.
+Addresses containing commas ("Doe, Jane" <foobar@example.com>) are not
+currently supported.
++
+This option may be specified multiple times.
 
---cc=<address>::
+--cc=<address>,...::
 	Specify a starting "Cc:" value for each email.
 	Default is the value of 'sendemail.cc'.
 +
-The --cc option must be repeated for each user you want on the cc list.
+Addresses containing commas ("Doe, Jane" <foobar@example.com>) are not
+currently supported.
++
+This option may be specified multiple times.
 
 --compose::
 	Invoke a text editor (see GIT_EDITOR in linkgit:git-var[1])
@@ -110,13 +116,16 @@ is not set, this will be prompted for.
 	Only necessary if --compose is also set.  If --compose
 	is not set, this will be prompted for.
 
---to=<address>::
+--to=<address>,...::
 	Specify the primary recipient of the emails generated. Generally, this
 	will be the upstream maintainer of the project involved. Default is the
 	value of the 'sendemail.to' configuration value; if that is unspecified,
 	and --to-cmd is not specified, this will be prompted for.
 +
-The --to option must be repeated for each user you want on the to list.
+Addresses containing commas ("Doe, Jane" <foobar@example.com>) are not
+currently supported.
++
+This option may be specified multiple times.
 
 --8bit-encoding=<encoding>::
 	When encountering a non-ASCII message or subject that does not
diff --git a/git-send-email.perl b/git-send-email.perl
index 0cac4b0..4bc489d 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -460,20 +460,6 @@ my ($repoauthor, $repocommitter);
 ($repoauthor) = Git::ident_person(@repo, 'author');
 ($repocommitter) = Git::ident_person(@repo, 'committer');
 
-# Verify the user input
-
-foreach my $entry (@initial_to) {
-	die "Comma in --to entry: $entry'\n" unless $entry !~ m/,/;
-}
-
-foreach my $entry (@initial_cc) {
-	die "Comma in --cc entry: $entry'\n" unless $entry !~ m/,/;
-}
-
-foreach my $entry (@bcclist) {
-	die "Comma in --bcclist entry: $entry'\n" unless $entry !~ m/,/;
-}
-
 sub parse_address_line {
 	if ($have_mail_address) {
 		return map { $_->format } Mail::Address->parse($_[0]);
@@ -808,10 +794,13 @@ sub expand_one_alias {
 	return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
 }
 
+@initial_to = split_at_commas(@initial_to);
 @initial_to = expand_aliases(@initial_to);
 @initial_to = validate_address_list(sanitize_address_list(@initial_to));
+@initial_cc = split_at_commas(@initial_cc);
 @initial_cc = expand_aliases(@initial_cc);
 @initial_cc = validate_address_list(sanitize_address_list(@initial_cc));
+@bcclist = split_at_commas(@bcclist);
 @bcclist = expand_aliases(@bcclist);
 @bcclist = validate_address_list(sanitize_address_list(@bcclist));
 
@@ -1026,6 +1015,10 @@ sub sanitize_address_list {
 	return (map { sanitize_address($_) } @_);
 }
 
+sub split_at_commas {
+	return (map { split /\s*,\s*/, $_ } @_);
+}
+
 # Returns the local Fully Qualified Domain Name (FQDN) if available.
 #
 # Tightly configured MTAa require that a caller sends a real DNS
@@ -1535,8 +1528,10 @@ foreach my $t (@files) {
 		($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
 	$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
 
+	@to = split_at_commas(@to);
 	@to = expand_aliases(@to);
 	@to = validate_address_list(sanitize_address_list(@to));
+	@cc = split_at_commas(@cc);
 	@cc = expand_aliases(@cc);
 	@cc = validate_address_list(sanitize_address_list(@cc));
 
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 806f066..9aee474 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -1648,4 +1648,48 @@ test_expect_success $PREREQ '--[no-]xmailer with sendemail.xmailer=false' '
 	do_xmailer_test 1 "--xmailer"
 '
 
+test_expect_success $PREREQ 'setup expected-list' '
+	git send-email \
+	--dry-run \
+	--from="Example <from@example.com>" \
+	--to="To 1 <to1@example.com>" \
+	--to="to2@example.com" \
+	--to="to3@example.com" \
+	--cc="Cc 1 <cc1@example.com>" \
+	--cc="Cc2 <cc2@example.com>" \
+	--bcc="bcc1@example.com" \
+	--bcc="bcc2@example.com" \
+	0001-add-master.patch | replace_variable_fields \
+	>expected-list
+'
+
+test_expect_success $PREREQ 'use email list in --cc --to and --bcc' '
+	git send-email \
+	--dry-run \
+	--from="Example <from@example.com>" \
+	--to="To 1 <to1@example.com>, to2@example.com" \
+	--to="to3@example.com" \
+	--cc="Cc 1 <cc1@example.com>, Cc2 <cc2@example.com>" \
+	--bcc="bcc1@example.com, bcc2@example.com" \
+	0001-add-master.patch | replace_variable_fields \
+	>actual-list &&
+	test_cmp expected-list actual-list
+'
+
+test_expect_success $PREREQ 'aliases work with email list' '
+	echo "alias to2 to2@example.com" >.mutt &&
+	echo "alias cc1 Cc 1 <cc1@example.com>" >>.mutt &&
+	test_config sendemail.aliasesfile ".mutt" &&
+	test_config sendemail.aliasfiletype mutt &&
+	git send-email \
+	--dry-run \
+	--from="Example <from@example.com>" \
+	--to="To 1 <to1@example.com>, to2, to3@example.com" \
+	--cc="cc1, Cc2 <cc2@example.com>" \
+	--bcc="bcc1@example.com, bcc2@example.com" \
+	0001-add-master.patch | replace_variable_fields \
+	>actual-list &&
+	test_cmp expected-list actual-list
+'
+
 test_done
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-06 16:59 [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test Remi Lespinet
                   ` (2 preceding siblings ...)
  2015-06-06 16:59 ` [PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc Remi Lespinet
@ 2015-06-06 16:59 ` Remi Lespinet
  2015-06-08 14:16   ` Matthieu Moy
  3 siblings, 1 reply; 11+ messages in thread
From: Remi Lespinet @ 2015-06-06 16:59 UTC (permalink / raw)
  To: git
  Cc: Remi Galan, Remi Lespinet, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite, Matthieu Moy

Simplify code by creating a function to transform list of email lists
(comma separated, with aliases ...)  into a simple list of valid email
addresses.

Signed-off-by: Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr>
---
 I'm not sure about the name of the function...

 git-send-email.perl | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/git-send-email.perl b/git-send-email.perl
index 4bc489d..ea03308 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -794,15 +794,9 @@ sub expand_one_alias {
 	return $aliases{$alias} ? expand_aliases(@{$aliases{$alias}}) : $alias;
 }
 
-@initial_to = split_at_commas(@initial_to);
-@initial_to = expand_aliases(@initial_to);
-@initial_to = validate_address_list(sanitize_address_list(@initial_to));
+@initial_to = process_address_list(@initial_to);
-@initial_cc = split_at_commas(@initial_cc);
-@initial_cc = expand_aliases(@initial_cc);
-@initial_cc = validate_address_list(sanitize_address_list(@initial_cc));
+@initial_cc = process_address_list(@initial_cc);
-@bcclist = split_at_commas(@bcclist);
-@bcclist = expand_aliases(@bcclist);
-@bcclist = validate_address_list(sanitize_address_list(@bcclist));
+@bcclist = process_address_list(@bcclist);
 
 if ($thread && !defined $initial_reply_to && $prompting) {
 	$initial_reply_to = ask(
@@ -1019,6 +1013,14 @@ sub split_at_commas {
 	return (map { split /\s*,\s*/, $_ } @_);
 }
 
+sub process_address_list {
+    my @addr_list = split_at_commas(@_);
+    @addr_list = expand_aliases(@addr_list);
+    @addr_list = sanitize_address_list(@addr_list);
+    @addr_list = validate_address_list(@addr_list);
+    return @addr_list;
+}
+
 # Returns the local Fully Qualified Domain Name (FQDN) if available.
 #
 # Tightly configured MTAa require that a caller sends a real DNS
@@ -1528,12 +1530,8 @@ foreach my $t (@files) {
 		($confirm =~ /^(?:auto|compose)$/ && $compose && $message_num == 1));
 	$needs_confirm = "inform" if ($needs_confirm && $confirm_unconfigured && @cc);
 
-	@to = split_at_commas(@to);
-	@to = expand_aliases(@to);
-	@to = validate_address_list(sanitize_address_list(@to));
+	@to = process_address_list(@to);
-	@cc = split_at_commas(@cc);
-	@cc = expand_aliases(@cc);
-	@cc = validate_address_list(sanitize_address_list(@cc));
+	@cc = process_address_list(@cc);
 
 	@to = (@initial_to, @to);
 	@cc = (@initial_cc, @cc);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-06 16:59 ` [PATCH/RFC v2 5/5] send-email: refactor address list process Remi Lespinet
@ 2015-06-08 14:16   ` Matthieu Moy
  2015-06-08 16:14     ` Remi Lespinet
  2015-06-08 18:36     ` Junio C Hamano
  0 siblings, 2 replies; 11+ messages in thread
From: Matthieu Moy @ 2015-06-08 14:16 UTC (permalink / raw)
  To: Remi Lespinet
  Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
	Antoine Delaite

Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:

> Simplify code by creating a function to transform list of email lists
> (comma separated, with aliases ...)  into a simple list of valid email
> addresses.

I would have found the series easier to read if this refactoring came
earlier (and then PATCH 2/5 would fix the bug as a positive side effect
of the refactoring). I think it's too late to change this, though.

>  I'm not sure about the name of the function...

process_address_list() sounds good to me.

The whole series looks good to me now.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-08 14:16   ` Matthieu Moy
@ 2015-06-08 16:14     ` Remi Lespinet
  2015-06-08 16:21       ` Matthieu Moy
  2015-06-08 18:36     ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: Remi Lespinet @ 2015-06-08 16:14 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
	Antoine Delaite

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
> 
> > Simplify code by creating a function to transform list of email lists
> > (comma separated, with aliases ...)  into a simple list of valid email
> > addresses.
> 
> I would have found the series easier to read if this refactoring came
> earlier (and then PATCH 2/5 would fix the bug as a positive side effect
> of the refactoring). I think it's too late to change this, though.

Why is it to late? I can still change it if necessary.

> >  I'm not sure about the name of the function...
> 
> process_address_list() sounds good to me.

Ok nice. :)

Thanks

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-08 16:14     ` Remi Lespinet
@ 2015-06-08 16:21       ` Matthieu Moy
  2015-06-08 17:36         ` Remi Lespinet
  0 siblings, 1 reply; 11+ messages in thread
From: Matthieu Moy @ 2015-06-08 16:21 UTC (permalink / raw)
  To: Remi Lespinet
  Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
	Antoine Delaite

Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:

> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>
>> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
>> 
>> > Simplify code by creating a function to transform list of email lists
>> > (comma separated, with aliases ...)  into a simple list of valid email
>> > addresses.
>> 
>> I would have found the series easier to read if this refactoring came
>> earlier (and then PATCH 2/5 would fix the bug as a positive side effect
>> of the refactoring). I think it's too late to change this, though.
>
> Why is it to late? I can still change it if necessary.

To me, the series is ready now, and I don't think re-rolling it would be
a good time investment. Plus, I spent time reviewing this series and
with my proposal I'd need to review a relatively different one.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-08 16:21       ` Matthieu Moy
@ 2015-06-08 17:36         ` Remi Lespinet
  0 siblings, 0 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-08 17:36 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: git, Remi Galan, Guillaume Pages, Louis-Alexandre Stuber,
	Antoine Delaite

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> To me, the series is ready now, and I don't think re-rolling it would be
> a good time investment. Plus, I spent time reviewing this series and
> with my proposal I'd need to review a relatively different one.

Ok, thanks.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-08 14:16   ` Matthieu Moy
  2015-06-08 16:14     ` Remi Lespinet
@ 2015-06-08 18:36     ` Junio C Hamano
  2015-06-08 22:12       ` Remi Lespinet
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2015-06-08 18:36 UTC (permalink / raw)
  To: Matthieu Moy
  Cc: Remi Lespinet, git, Remi Galan, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
>
>> Simplify code by creating a function to transform list of email lists
>> (comma separated, with aliases ...)  into a simple list of valid email
>> addresses.
>
> I would have found the series easier to read if this refactoring came
> earlier (and then PATCH 2/5 would fix the bug as a positive side effect
> of the refactoring).

I agree that doing 5/5 sooner would make 4/5 a lot clearer.  

Introducing the helper of 5/5 before 2/5 happens, and then replacing
two calls to validate-address-list with process-address-list would
hide the nature of the change, i.e. fixing a bug, so it is better to
see it done before the refactoring of 5/5, provided if it is indeed
a bug that these were not expanded.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH/RFC v2 5/5] send-email: refactor address list process
  2015-06-08 18:36     ` Junio C Hamano
@ 2015-06-08 22:12       ` Remi Lespinet
  0 siblings, 0 replies; 11+ messages in thread
From: Remi Lespinet @ 2015-06-08 22:12 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Matthieu Moy, git, Remi Galan, Guillaume Pages,
	Louis-Alexandre Stuber, Antoine Delaite

Junio C Hamano <gitster@pobox.com> writes

> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
> 
> > Remi Lespinet <remi.lespinet@ensimag.grenoble-inp.fr> writes:
> >
> >> Simplify code by creating a function to transform list of email lists
> >> (comma separated, with aliases ...)  into a simple list of valid email
> >> addresses.
> >
> > I would have found the series easier to read if this refactoring came
> > earlier (and then PATCH 2/5 would fix the bug as a positive side effect
> > of the refactoring).
> 
> I agree that doing 5/5 sooner would make 4/5 a lot clearer.  
> 
> Introducing the helper of 5/5 before 2/5 happens, and then replacing
> two calls to validate-address-list with process-address-list would
> hide the nature of the change, i.e. fixing a bug, so it is better to
> see it done before the refactoring of 5/5, provided if it is indeed
> a bug that these were not expanded.

Ok thanks, I submit it again soon. Also I think we should swap the
lines 'sanitize_address_list(...)' and 'expand_aliases(...)',
i.e. first sanitize addresses and then expand aliases.

We could then remove leading and trailing whitespaces in the
sanitize_address_list function as aliases file formats supported by git
send-email doesn't take these whitespace into account anyway:

Example which currently can't work:

git send-email --to=" alias" ...

Moreover I think it's more natural to do that so.

I'll do it right after the refactoring patch introducing
process_address_list or maybe I should avoid changing this patch now ?

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-06-08 22:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-06 16:59 [PATCH/RFC v2 1/5] t9001-send-email: move script creation in a setup test Remi Lespinet
2015-06-06 16:59 ` [PATCH/RFC v2 2/5] send-email: allow aliases in patch header and command script outputs Remi Lespinet
2015-06-06 16:59 ` [PATCH/RFC v2 3/5] t9001-send-email: refactor header variable fields replacement Remi Lespinet
2015-06-06 16:59 ` [PATCH/RFC v2 4/5] send-email: allow multiple emails using --cc, --to and --bcc Remi Lespinet
2015-06-06 16:59 ` [PATCH/RFC v2 5/5] send-email: refactor address list process Remi Lespinet
2015-06-08 14:16   ` Matthieu Moy
2015-06-08 16:14     ` Remi Lespinet
2015-06-08 16:21       ` Matthieu Moy
2015-06-08 17:36         ` Remi Lespinet
2015-06-08 18:36     ` Junio C Hamano
2015-06-08 22:12       ` Remi Lespinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).