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

Re: [PATCH 2/2] Add a 'source' decorator for commits

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Oct 28, 2008, 17:21 UTC
Message-ID
<alpine.LFD.2.00.0810281016150.3386@nehalem.linux-foundation.org>
In-Reply-To
<alpine.LFD.2.00.0810280755570.3386@nehalem.linux-foundation.org>
On Tue, 28 Oct 2008, Linus Torvalds wrote:
Show 7 quoted lines
> 
> I could imagine doing it as not a single string: you could make it be a 
> pointer to a list of (alphabetically sorted) strings, and then you don't 
> have to make an allocation for each commit, you'd only need to do 
> something like
> 
> 	void add_source(struct commit *commit, struct strin_list *list)
Actually, no. That would be wrong.

Why? Becuase we might be printing out the commit before we see it for the second time, so if we were to print out anything but the "first reached data", we'd now have really nasty _unreliable_ data that would actually change depending on whether we also do things like --topo-sort and/or do commit limiting.

So suddenly --source would have to do the full tree just to make sure that it's reliably giving the same information, and that makes it much less useful.

In contrast, the thing I sent out is not only really simple and has basically zero peformance impact, but it's actually "more reliable" in that what it gives you is meaningful and clear. It might pick one particular name over another in random ways that depend on internal choices and the exact order that you gave your arguments in, but it doesn't even _try_ to claim anything else.

The source "name" is unambiguous only if there is a single source, and it doesn't really even try to claim anything else - for other cases, it will give answers that "make sense" but they won't necessarily be the _whole_ truth. But it won't ever be really misleading either, and it will never cause any slowdowns.

		Linus
Previous: Linus TorvaldsNext: Jeff King
Message 12 of 14 in “Random patches from my tree”
  1. 0/2 Random patches from my treeLinus Torvalds, Oct 27, 2008
  2. 1/2 Add file delete/create info when we overflow rename_limitLinus Torvalds, Oct 27, 2008
  3. 2/2 Add a 'source' decorator for commitsLinus Torvalds, Oct 27, 2008
  4. Jeff KingOct 28, 2008
  5. Pierre HabouzitOct 28, 2008
  6. Pierre HabouzitOct 28, 2008
  7. Jeff KingOct 28, 2008
  8. Jeff KingOct 28, 2008
  9. Pierre HabouzitOct 28, 2008
  10. Jeff KingOct 28, 2008
  11. Linus TorvaldsOct 28, 2008
  12. Linus TorvaldsOct 28, 2008
  13. Jeff KingOct 28, 2008
  14. Linus TorvaldsOct 27, 2008

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.