diff mbox series

[v2,1/3] t90001-send-email.sh: fix quoting for mailrc --dump-aliases test

Message ID 20240813-jk-translate-alias-send-email-v2-1-912db4eb6846@gmail.com (mailing list archive)
State Accepted
Commit 16d89aa9753f246bdc2c97275b14eb1a33faa55f
Headers show
Series send-email: teach git send-email mode to translate aliases | expand

Commit Message

Jacob Keller Aug. 14, 2024, 12:05 a.m. UTC
From: Jacob Keller <jacob.keller@gmail.com>

The .mailrc alias file format documents that multiple addresses are
separated by spaces. The alias file used in the t9001 --dump-aliases
mailrc test have addresses which include both a name and email. These
are unquoted, so git send-email will parse this as an alias that
translates to multiple independent addresses.

The existing test does not care about this, as --dump-aliases only dumps
the alias and not the address. However, it is incorrect for a future
where --dump-aliases could also dump the mail addresses.

Fix the test to quote the aliases properly, so that they translate to a
single address.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---
 t/t9001-send-email.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Junio C Hamano Aug. 14, 2024, 4:56 p.m. UTC | #1
Jacob Keller <jacob.e.keller@intel.com> writes:

> From: Jacob Keller <jacob.keller@gmail.com>
>
> The .mailrc alias file format documents that multiple addresses are
> separated by spaces. The alias file used in the t9001 --dump-aliases
> mailrc test have addresses which include both a name and email. These
> are unquoted, so git send-email will parse this as an alias that
> translates to multiple independent addresses.
>
> The existing test does not care about this, as --dump-aliases only dumps
> the alias and not the address. However, it is incorrect for a future
> where --dump-aliases could also dump the mail addresses.
>
> Fix the test to quote the aliases properly, so that they translate to a
> single address.
>
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
>  t/t9001-send-email.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Makes sense.  I'll amend the excess "0" out of the title while
queuing.

Thanks.

>
> diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
> index 64a4ab3736ef..aa36ace393b7 100755
> --- a/t/t9001-send-email.sh
> +++ b/t/t9001-send-email.sh
> @@ -2084,9 +2084,9 @@ test_dump_aliases '--dump-aliases mailrc format' \
>  	'bob' \
>  	'chloe' \
>  	'eve' <<-\EOF
> -	alias alice   Alice W Land <awol@example.com>
> -	alias eve     Eve <eve@example.com>
> -	alias bob     Robert Bobbyton <bob@example.com>
> +	alias alice   "Alice W Land <awol@example.com>"
> +	alias eve     "Eve <eve@example.com>"
> +	alias bob     "Robert Bobbyton <bob@example.com>"
>  	alias chloe   chloe@example.com
>  	EOF
diff mbox series

Patch

diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh
index 64a4ab3736ef..aa36ace393b7 100755
--- a/t/t9001-send-email.sh
+++ b/t/t9001-send-email.sh
@@ -2084,9 +2084,9 @@  test_dump_aliases '--dump-aliases mailrc format' \
 	'bob' \
 	'chloe' \
 	'eve' <<-\EOF
-	alias alice   Alice W Land <awol@example.com>
-	alias eve     Eve <eve@example.com>
-	alias bob     Robert Bobbyton <bob@example.com>
+	alias alice   "Alice W Land <awol@example.com>"
+	alias eve     "Eve <eve@example.com>"
+	alias bob     "Robert Bobbyton <bob@example.com>"
 	alias chloe   chloe@example.com
 	EOF