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

Re: [PATCH] commit: Add commit_list prefix to reduce_heads function.

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 5, 2010, 05:24 UTC
Message-ID
<7vsjycx05o.fsf@alter.siamese.dyndns.org>
In-Reply-To
<a3f4bdc2d5f5d13c772a82de9afe2691b8a12863.1291514223.git.tfransosi@gmail.com>
Thiago Farina <tfransosi@gmail.com> writes:
> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
I really do not like this.

The use of type "struct commit_list" to hold the set of parent commits is incidental; if we had "struct commit_set", we would have written a function with the same purpose, and named it the same "reduce_HEADS".

Adding commit_list to the name makes the code harder to read (and type) with little added benefit. "LIST"-ness is not the important part.

If a function takes a commit_list, named "reduce_HEADS", and returns a commit_list, what it does should be obvious to you; otherwise you shouldn't be touching the internal of git.

Having said that, I do not claim "reduce_heads" is the world most wonderful short-sweet-descriptive name for what this function does and there cannot be any better name. But commit_list_reduce_head is not it.

If the patch were to rename the function, especially the HEADs part, to clarify what it does, instead of how (iow, what type it uses to hold the data) it does it, my reaction would have been very different.

Previous: Junio C HamanoNext: Thiago Farina
Message 11 of 13 in “commit: Add commit_list prefix to reduce_heads function.”
  1. commit: Add commit_list prefix to reduce_heads function.Thiago Farina, Dec 5, 2010
  2. Jonathan NiederDec 5, 2010
  3. Thiago FarinaDec 5, 2010
  4. Jonathan NiederDec 5, 2010
  5. Thiago FarinaDec 5, 2010
  6. Thiago FarinaDec 5, 2010
  7. Junio C HamanoDec 5, 2010
  8. Thiago FarinaDec 5, 2010
  9. Junio C HamanoDec 6, 2010
  10. Junio C HamanoDec 6, 2010
  11. Junio C HamanoDec 5, 2010
  12. Thiago FarinaDec 5, 2010
  13. Junio C HamanoDec 5, 2010

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.