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

Re: limiting git branch --contains

From
Jeff King <peff@peff.net>
Date
Mar 25, 2023, 06:30 UTC
Message-ID
<20230325063035.GA562387@coredump.intra.peff.net>
In-Reply-To
<ZB4e/yE+25W66z6S@ugly>
On Fri, Mar 24, 2023 at 11:06:55PM +0100, Oswald Buddenhagen wrote:
Show 5 quoted lines
> > Ah, that is your problem. When "replace" refs are in use, the data
> > stored in the commit-graph can't reliably be used. [...]
> > 
> why isn't the commit-graph built with the replaces applied (and tagged by a
> hash of the used replaces, so we know when to ignore it)?

I think a similar idea has come up before, but we decided to do the simplest safe thing (disabling optimizations) to start with. And then somebody who really cared about making optimizations work with commit graphs could come along and do so later. Nobody has yet; you could be that someone. ;)

> at minimum, i'd expect a warning giving a reason when the graph is ignored.

That might be reasonable. The commit graph is an optimization, so we'd never produce a wrong answer by ignoring it. And since the fallback was the status quo before the optimizations were implemented, it didn't seem like that big a deal. But these days the performance many of us expect is with those optimizations, so perhaps the tables have turned.

I do think there might be some complications, though. I think we may build commit graphs by default these days during "gc" and even incrementally after "fetch". If we warned when the graphs are disabled, it basically means that every command in a repo with replace refs would issue the warning.

Show 6 quoted lines
> > I'd still be curious to see the
> > difference between "just commit graphs" and "commit graphs plus the
> > patch I showed earlier". I think it should make things faster, but if
> > it's only a few milliseconds on average, it's not that urgent to pursue.
> > 
> if there is a speed difference at all, it gets drowned out by the noise.

OK, thanks for testing. I do think that looking into a true single traversal might make sense, but I don't think we've seen a case yet where it's a substantial speedup.

-Peff
Previous: Oswald BuddenhagenNext: Oswald Buddenhagen
Message 12 of 17 in “limiting git branch --contains”
  1. Oswald BuddenhagenMar 23, 2023
  2. Junio C HamanoMar 23, 2023
  3. Oswald BuddenhagenMar 23, 2023
  4. Derrick StoleeMar 24, 2023
  5. Oswald BuddenhagenMar 24, 2023
  6. Derrick StoleeMar 24, 2023
  7. Oswald BuddenhagenMar 24, 2023
  8. Jeff KingMar 24, 2023
  9. Oswald BuddenhagenMar 24, 2023
  10. Jeff KingMar 24, 2023
  11. Oswald BuddenhagenMar 24, 2023
  12. Jeff KingMar 25, 2023
  13. Oswald BuddenhagenMar 25, 2023
  14. Jeff KingMar 24, 2023
  15. Kristofer KarlssonMay 27, 2026
  16. Jeff KingJun 8, 2026
  17. Felipe ContrerasMar 23, 2023

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.