git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] t4203: fix checks for email address remapping
@ 2013-07-13  0:35 Eric Sunshine
  2013-07-13  6:29 ` Stefan Beller
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Sunshine @ 2013-07-13  0:35 UTC (permalink / raw)
  To: git; +Cc: Eric Sunshine

Two tests in t4203-mailmap.sh set up the mapping <bugs@company.xx> =>
<bugs@company.xy> in an apparent attempt to check that email address
remapping works as expected (in addition to name remapping which is also
tested).  To test the remapping, git-shortlog is invoked but the
invocation lacks the -e option instructing it to show email addresses,
hence the tests do not actually prove that address remapping succeeded.
Fix this by instructing git-shortlog to output email addresses as well.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
---

The very last git-shortlog "complex" test in the script does use -e and
checks that email address remapping actually works, so it's not clear
that this patch is needed. The <bugs@company.xx> => <bugs@company.xy>
remapping done by the two tests touched by this patch, however, is
misleading to the reader since it seems to imply that these two tests
want to check address remapping as well. Perhaps a better change would
be to remove the address remapping from these two tests.


 t/t4203-mailmap.sh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
index 842b754..3cf64de 100755
--- a/t/t4203-mailmap.sh
+++ b/t/t4203-mailmap.sh
@@ -102,10 +102,10 @@ test_expect_success 'mailmap.file non-existent' '
 '
 
 cat >expect <<\EOF
-Internal Guy (1):
+Internal Guy <bugs@company.xy> (1):
       second
 
-Repo Guy (1):
+Repo Guy <author@example.com> (1):
       initial
 
 EOF
@@ -114,15 +114,15 @@ test_expect_success 'name entry after email entry' '
 	mkdir -p internal_mailmap &&
 	echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
 	echo "Internal Guy <bugs@company.xx>" >>internal_mailmap/.mailmap &&
-	git shortlog HEAD >actual &&
+	git shortlog -e HEAD >actual &&
 	test_cmp expect actual
 '
 
 cat >expect <<\EOF
-Internal Guy (1):
+Internal Guy <bugs@company.xy> (1):
       second
 
-Repo Guy (1):
+Repo Guy <author@example.com> (1):
       initial
 
 EOF
@@ -131,7 +131,7 @@ test_expect_success 'name entry after email entry, case-insensitive' '
 	mkdir -p internal_mailmap &&
 	echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
 	echo "Internal Guy <BUGS@Company.xx>" >>internal_mailmap/.mailmap &&
-	git shortlog HEAD >actual &&
+	git shortlog -e HEAD >actual &&
 	test_cmp expect actual
 '
 
-- 
1.8.3.2.804.g0da7a53

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

* Re: [PATCH] t4203: fix checks for email address remapping
  2013-07-13  0:35 [PATCH] t4203: fix checks for email address remapping Eric Sunshine
@ 2013-07-13  6:29 ` Stefan Beller
  2013-07-15  7:00   ` Eric Sunshine
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2013-07-13  6:29 UTC (permalink / raw)
  To: Eric Sunshine; +Cc: git

On 07/13/2013 02:35 AM, Eric Sunshine wrote:
> Two tests in t4203-mailmap.sh set up the mapping <bugs@company.xx> =>
> <bugs@company.xy> in an apparent attempt to check that email address
> remapping works as expected (in addition to name remapping which is also
> tested).  To test the remapping, git-shortlog is invoked but the
> invocation lacks the -e option instructing it to show email addresses,
> hence the tests do not actually prove that address remapping succeeded.
> Fix this by instructing git-shortlog to output email addresses as well.
> 
> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
> ---
> 
> The very last git-shortlog "complex" test in the script does use -e and
> checks that email address remapping actually works, so it's not clear
> that this patch is needed. The <bugs@company.xx> => <bugs@company.xy>
> remapping done by the two tests touched by this patch, however, is
> misleading to the reader since it seems to imply that these two tests
> want to check address remapping as well. Perhaps a better change would
> be to remove the address remapping from these two tests.
> 
> 
>  t/t4203-mailmap.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/t/t4203-mailmap.sh b/t/t4203-mailmap.sh
> index 842b754..3cf64de 100755
> --- a/t/t4203-mailmap.sh
> +++ b/t/t4203-mailmap.sh
> @@ -102,10 +102,10 @@ test_expect_success 'mailmap.file non-existent' '
>  '
>  
>  cat >expect <<\EOF
> -Internal Guy (1):
> +Internal Guy <bugs@company.xy> (1):
>        second
>  
> -Repo Guy (1):
> +Repo Guy <author@example.com> (1):
>        initial
>  
>  EOF
> @@ -114,15 +114,15 @@ test_expect_success 'name entry after email entry' '
>  	mkdir -p internal_mailmap &&
>  	echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
>  	echo "Internal Guy <bugs@company.xx>" >>internal_mailmap/.mailmap &&
> -	git shortlog HEAD >actual &&
> +	git shortlog -e HEAD >actual &&
>  	test_cmp expect actual
>  '
>  
>  cat >expect <<\EOF
> -Internal Guy (1):
> +Internal Guy <bugs@company.xy> (1):
>        second
>  
> -Repo Guy (1):
> +Repo Guy <author@example.com> (1):
>        initial
>  
>  EOF
> @@ -131,7 +131,7 @@ test_expect_success 'name entry after email entry, case-insensitive' '
>  	mkdir -p internal_mailmap &&
>  	echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
>  	echo "Internal Guy <BUGS@Company.xx>" >>internal_mailmap/.mailmap &&+

So here it is capitalized email address (BUGS@), but at the expect file
it's still lower cased. I think this is a bug.
Junio was trying to fix it in 543f99173c2d2f648d8f846e24875150f7de03d3
(origin/jc/mailmap-case-insensitivity)
So I think we need another yet test case there:
commited:
    Internal Guy <BUGS@Company.xx>
    Internal Guy <bugs@company.xy>

Having just one entry in the mailmap
    Internal Guy <BUGS@Company.xx> <bugs@Company.xy>

should still work with the "shortlog -e"

> -	git shortlog HEAD >actual &&
> +	git shortlog -e HEAD >actual &&
>  	test_cmp expect actual
>  '
>  
> 

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

* Re: [PATCH] t4203: fix checks for email address remapping
  2013-07-13  6:29 ` Stefan Beller
@ 2013-07-15  7:00   ` Eric Sunshine
  0 siblings, 0 replies; 3+ messages in thread
From: Eric Sunshine @ 2013-07-15  7:00 UTC (permalink / raw)
  To: Stefan Beller; +Cc: Git List

On Sat, Jul 13, 2013 at 2:29 AM, Stefan Beller
<stefanbeller@googlemail.com> wrote:
> On 07/13/2013 02:35 AM, Eric Sunshine wrote:
>> Two tests in t4203-mailmap.sh set up the mapping <bugs@company.xx> =>
>> <bugs@company.xy> in an apparent attempt to check that email address
>> remapping works as expected (in addition to name remapping which is also
>> tested).  To test the remapping, git-shortlog is invoked but the
>> invocation lacks the -e option instructing it to show email addresses,
>> hence the tests do not actually prove that address remapping succeeded.
>> Fix this by instructing git-shortlog to output email addresses as well.
>>
>> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
>> ---
>>
>> The very last git-shortlog "complex" test in the script does use -e and
>> checks that email address remapping actually works, so it's not clear
>> that this patch is needed. The <bugs@company.xx> => <bugs@company.xy>
>> remapping done by the two tests touched by this patch, however, is
>> misleading to the reader since it seems to imply that these two tests
>> want to check address remapping as well. Perhaps a better change would
>> be to remove the address remapping from these two tests.
>>
>>  cat >expect <<\EOF
>> -Internal Guy (1):
>> +Internal Guy <bugs@company.xy> (1):
>>        second
>>
>> -Repo Guy (1):
>> +Repo Guy <author@example.com> (1):
>>        initial
>>
>>  EOF
>> @@ -131,7 +131,7 @@ test_expect_success 'name entry after email entry, case-insensitive' '
>>       mkdir -p internal_mailmap &&
>>       echo "<bugs@company.xy> <bugs@company.xx>" >internal_mailmap/.mailmap &&
>>       echo "Internal Guy <BUGS@Company.xx>" >>internal_mailmap/.mailmap &&+
>
> So here it is capitalized email address (BUGS@), but at the expect file
> it's still lower cased. I think this is a bug.
> Junio was trying to fix it in 543f99173c2d2f648d8f846e24875150f7de03d3
> (origin/jc/mailmap-case-insensitivity)

With the re-roll of Junio's series which I just sent out [1], this
case-preserving problem is tested (and fixed), and email address
remapping is tested in general, so I think this submission should be
retired.

(It might still be worthwhile, as mentioned in the patch commentary,
to drop the confusing lines altogether from those two tests, but
that's an issue for another day.)

[1]: http://thread.gmane.org/gmane.comp.version-control.git/230425/

> So I think we need another yet test case there:
> commited:
>     Internal Guy <BUGS@Company.xx>
>     Internal Guy <bugs@company.xy>
>
> Having just one entry in the mailmap
>     Internal Guy <BUGS@Company.xx> <bugs@Company.xy>
>
> should still work with the "shortlog -e"
>
>> -     git shortlog HEAD >actual &&
>> +     git shortlog -e HEAD >actual &&
>>       test_cmp expect actual
>>  '

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

end of thread, other threads:[~2013-07-15  7:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-13  0:35 [PATCH] t4203: fix checks for email address remapping Eric Sunshine
2013-07-13  6:29 ` Stefan Beller
2013-07-15  7:00   ` Eric Sunshine

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).