git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug in .mailmap handling?

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 12, 2013, 17:35 UTC
Message-ID
<7vppunllzf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<51E029B9.20108@googlemail.com>
Stefan Beller <stefanbeller@googlemail.com> writes:
Show 29 quoted lines
> Hello,
>
> you may have noticed I am currently trying to bring the 
> mailmap file of git itself up to date. I noticed
> some behavior, which I did not expect. Have a look yourself:
>
> ---
> 	# prepare test environment:
> 	mkdir testmailmap
> 	cd testmailmap/
> 	git init
>
> 	# do a commit:
> 	echo "asdf" > test1 
> 	git add test1
> 	git commit -a --author="A <A@example.org>" -m "add test1"
>
> 	# commit with same name, but different email 
> 	# (different capitalization does the trick already, 
> 	# but here I am going to use a different mail)
> 	echo "asdf" > test2
> 	git add test2
> 	git commit -a --author="A <changed_email@example.org>" -m "add test2"
>
> 	# how do we know it's the same person?
> 	git shortlog
> 	A (2):
> 		  add test1
> 		  add test2
You don't, and it is a long known behaviour.
> 	# reports as expected:
> 	git shortlog -sne
> 		  1  A <A@example.org>
> 		  1  A <changed_email@example.org>
Yes.
Show 8 quoted lines
> 	# Adding the line to the mailmap should make life easy, so we know
> 	# it's the same person
> 	echo "A <A@example.org> <changed_email@example.org>" > .mailmap
>
> 	# Come on, I just wanted to have it reported as one person!
> 	git shortlog -sne
> 		 1  A <A@example.org>
> 		 1  A <a@example.org>

Err, where does the lowercase a@ come from in the above? Are we missing some steps before we get here?

> 	# So let's try another line in the mailmap file, (small 'a')
> 	echo "A <a@example.org> <changed_email@example.org>" > .mailmap

This is ">", not ">>", I presume? Otherwise changed_email is mapped to two destination, no?

> 	# We're not there yet?
> 	git shortlog -sne
> 		 1  A <A@example.org>
> 		 1  A <a@example.org>

Expected, as long as some hidden set-up you did not describe that caused me to say "Err, where does the lowercase a@ come from" is there, i.e. one of the two commits is done by <a@example.org>.

Show 10 quoted lines
> 	# Now let's write it rather explicit: 
> 	# (essentially just write 2 lines into the mailmap file)
> 	cat << EOF > .mailmap
> 	A <a@example.org> <changed_email@example.org>
> 	A <a@example.org> <A@example.org>
> 	EOF
> 		 
> 	# works as expected now
> 	git shortlog -sne
> 		 2  A <a@example.org>
Makes sense.
Show 5 quoted lines
> 	# works as expected now as well
> 	git shortlog      
> 	A (2):
> 		  add test1
> 		  add test2
Previous: Stefan BellerNext: Stefan Beller
Message 2 of 8 in “Bug in .mailmap handling?”
  1. Stefan BellerJul 12, 2013
  2. Junio C HamanoJul 12, 2013
  3. Stefan BellerJul 12, 2013
  4. Junio C HamanoJul 12, 2013
  5. Stefan BellerJul 12, 2013
  6. Junio C HamanoJul 12, 2013
  7. Junio C HamanoJul 12, 2013
  8. Add a testcase for checking case insensitivity of mail mapStefan Beller, Jul 12, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.