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

Re: Slow git pack-refs --all

From
Jeff King <peff@peff.net>
Date
Dec 27, 2025, 07:36 UTC
Message-ID
<20251227073634.GA2071715@coredump.intra.peff.net>
In-Reply-To
<aU7Cs2pXiXInfBh4@fruit.crustytoothpaste.net>
On Fri, Dec 26, 2025 at 05:15:31PM +0000, brian m. carlson wrote:
Show 10 quoted lines
> >   If we wanted to be really pedantic, anything in refs/heads/ should not
> >   point to a non-commit and thus should never need to be peeled. I'm not
> >   sure if we want to embed that assumption in this code path, though
> >   (nor would it necessarily help Martin's case if the refs are not in
> >   refs/heads anyway).
> 
> I don't think that would be a good idea.  I know that people definitely
> do updates of the loose refs by hand (although they should not) and so
> it's entirely possible for them to contain invalid values, such as
> having branches contain non-commit objects.
Yeah, that matches my inclination.
> I wonder if reftable would avoid the need for this kind of expensive
> check since it would already have the data peeled if need be and
> wouldn't need to recompute the values.

It does the same amount of peeling, but it's amortized across more operations (i.e., whatever did those ref updates in the first place) rather than during the pack operation. And of course there really is no pack operation per se with reftables, but I believe it avoids re-peeling when rewriting entries during compaction.

It might actually do fewer object accesses overall if the ref-writing operations have already loaded the objects in question (and thus it knows whether they're tags or not, and may even have parsed tags in memory). It can also do more in some cases (e.g., two loose writes will peel for each write, whereas the files backend only bothers to peel during packing).

-Peff
Previous: brian m. carlsonNext: Martin Fick
Message 5 of 19 in “Slow git pack-refs --all”
  1. Martin FickDec 25, 2025
  2. brian m. carlsonDec 25, 2025
  3. Jeff KingDec 26, 2025
  4. brian m. carlsonDec 26, 2025
  5. Jeff KingDec 27, 2025
  6. Martin FickDec 31, 2025
  7. Jeff KingJan 2, 2026
  8. Martin FickJan 5, 2026
  9. Patrick SteinhardtJan 6, 2026
  10. Martin FickJan 6, 2026
  11. Patrick SteinhardtJan 7, 2026
  12. Martin FickJan 7, 2026
  13. Patrick SteinhardtJan 8, 2026
  14. Jeff KingJan 15, 2026
  15. Martin FickJan 16, 2026
  16. Martin FickJan 7, 2026
  17. Jeff KingJan 6, 2026
  18. Martin FickJan 6, 2026
  19. Martin FickDec 31, 2025

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.