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

Re: [PATCH 1/3] blame: fix email output with mailmap

From
Jeff King <peff@peff.net>
Date
Feb 4, 2012, 23:39 UTC
Message-ID
<20120204233909.GA1366@sigill.intra.peff.net>
In-Reply-To
<1328385024-6955-2-git-send-email-felipe.contreras@gmail.com>
On Sat, Feb 04, 2012 at 09:50:22PM +0200, Felipe Contreras wrote:
Show 20 quoted lines
> diff --git a/builtin/blame.c b/builtin/blame.c
> index 5a67c20..dd69e51 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> @@ -1403,10 +1403,13 @@ static void get_ac_line(const char *inbuf, const char *what,
>  	 * Now, convert both name and e-mail using mailmap
>  	 */
>  	if (map_user(&mailmap, mail+1, mail_len-1, person, tmp-person-1)) {
> -		/* Add a trailing '>' to email, since map_user returns plain emails
> -		   Note: It already has '<', since we replace from mail+1 */
> +		/*
> +		 * Add a trailing '>' to email, since map_user returns plain
> +		 * emails when it finds a matching mail.
> +		 * Note: It already has '<', since we replace from mail + 1
> +		 */
>  		mailpos = memchr(mail, '\0', mail_len);
> -		if (mailpos && mailpos-mail < mail_len - 1) {
> +		if (mailpos && mailpos-mail < mail_len - 1 && *(mailpos - 1) != '>') {
>  			*mailpos = '>';
>  			*(mailpos+1) = '\0';

I'm not sure if it's possible, but do you need to be checking that "mailpos > mail" to avoid reading off the beginning of the buffer? It would mean the email field is empty, which may or may not be possible.

-Peff
Previous: Felipe ContrerasNext: Thomas Rast
Message 3 of 22 in “blame: fix output with mailmap”
  1. 0/3 blame: fix output with mailmapFelipe Contreras, Feb 4, 2012
  2. 1/3 blame: fix email output with mailmapFelipe Contreras, Feb 4, 2012
  3. Jeff KingFeb 4, 2012
  4. Thomas RastFeb 5, 2012
  5. Felipe ContrerasFeb 5, 2012
  6. Jeff KingFeb 6, 2012
  7. 2/3 t: mailmap: add 'git blame -e' testsFelipe Contreras, Feb 4, 2012
  8. Jonathan NiederFeb 4, 2012
  9. Felipe ContrerasFeb 4, 2012
  10. Jonathan NiederFeb 4, 2012
  11. Felipe ContrerasFeb 4, 2012
  12. Junio C HamanoFeb 5, 2012
  13. Felipe ContrerasFeb 5, 2012
  14. 3/3 t: mailmap: add simple name translation testFelipe Contreras, Feb 4, 2012
  15. Jonathan NiederFeb 4, 2012
  16. Felipe ContrerasFeb 4, 2012
  17. Jonathan NiederFeb 4, 2012
  18. Felipe ContrerasFeb 4, 2012
  19. Jeff KingFeb 4, 2012
  20. Felipe ContrerasFeb 6, 2012
  21. Jonathan NiederFeb 5, 2012
  22. Felipe ContrerasFeb 6, 2012

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.