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

Re: [PATCH 04/10] mailmap: simplify map_user() interface

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 6, 2013, 22:56 UTC
Message-ID
<7vehhxnco3.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1357421206-5014-5-git-send-email-apelisse@gmail.com>
Antoine Pelisse <apelisse@gmail.com> writes:
Show 37 quoted lines
> diff --git a/builtin/blame.c b/builtin/blame.c
> index dd4aff9..86450e3 100644
> --- a/builtin/blame.c
> +++ b/builtin/blame.c
> ...
> @@ -1356,51 +1356,61 @@ static void get_ac_line(const char *inbuf, const char *what,
>  		len = strlen(tmp);
>  	else
>  		len = endp - tmp;
>  
>  	if (split_ident_line(&ident, tmp, len)) {
>  	error_out:
>  		/* Ugh */
> +		tmp = "(unknown)";
> +		strbuf_addstr(name, tmp);
> +		strbuf_addstr(mail, tmp);
> +		strbuf_addstr(tz, tmp);
>  		*time = 0;
>  		return;
>  	}
>  
>  	namelen = ident.name_end - ident.name_begin;
> +	tmpname = ident.name_begin;
>  
> +	maillen = ident.mail_end - ident.mail_begin;
> +	tmpmail = ident.mail_begin;
>  
>  	*time = strtoul(ident.date_begin, NULL, 10);
>  
> +	len = ident.tz_end - ident.tz_begin;
> +	strbuf_add(tz, ident.tz_begin, len);
>  
>  	/*
>  	 * Now, convert both name and e-mail using mailmap
>  	 */
> +	map_user(&mailmap, &tmpmail, &maillen,
> +		 &tmpname, &namelen);

I like the general simplification this change gives us, but do we still want to name these variables "tmp"-something? At least to me, it makes it look like the variable holds a pointer to a piece of memory that was temporarily allocated. Calling it "mail_begin" or something might be less confusing.

The changes to pretty.c (pp_user_info) and shortlog.c (insert_one_record) calls these variables mailbuf and namebuf, so perhaps these are better names?

Previous: Antoine PelisseNext: Antoine Pelisse
Message 8 of 14 in “Log mailmap optimization”
  1. 00/10 Log mailmap optimizationAntoine Pelisse, Jan 5, 2013
  2. 01/10 list_lookup: create case and length searchAntoine Pelisse, Jan 5, 2013
  3. Junio C HamanoJan 5, 2013
  4. Junio C HamanoJan 7, 2013
  5. 02/10 Use split_ident_line to parse author and committerAntoine Pelisse, Jan 5, 2013
  6. 03/10 mailmap: remove email copy and length limitationAntoine Pelisse, Jan 5, 2013
  7. 04/10 mailmap: simplify map_user() interfaceAntoine Pelisse, Jan 5, 2013
  8. Junio C HamanoJan 6, 2013
  9. 05/10 mailmap: add mailmap structure to rev_info and ppAntoine Pelisse, Jan 5, 2013
  10. 06/10 pretty: use mailmap to display username and emailAntoine Pelisse, Jan 5, 2013
  11. 07/10 log: add --use-mailmap optionAntoine Pelisse, Jan 5, 2013
  12. 08/10 test: add test for --use-mailmap optionAntoine Pelisse, Jan 5, 2013
  13. 09/10 log: grep author/committer using mailmapAntoine Pelisse, Jan 5, 2013
  14. 10/10 log: add log.mailmap configuration optionAntoine Pelisse, Jan 5, 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.