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

git auto-repack is broken...

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 2, 2011, 16:22 UTC
Message-ID
<CA+55aFznj49hx6Ce6NhJ1rRd2nvNyOERseyyrC6SNcW-z9dyfg@mail.gmail.com>

I actually tend to repack things pretty religiously (ok, not really, but I do "git gc" reasonably regularly, so I was surprised to see thig:

  Auto packing the repository for optimum performance. You may also
  run "git gc" manually. See "git help gc" for more information.
followed by this pitiful effort:
  Counting objects: 8, done.
  Delta compression using up to 4 threads.
  Compressing objects: 100% (8/8), done.
  Writing objects: 100% (8/8), done.
  Total 8 (delta 0), reused 0 (delta 0)

Ok, those 8 objects will *not* help anything at all, and the autorepack is broken.

So what's going on? It turns out that I have a fair amount of unreachable objects in this repository, because I do things like fetching things without then merging them, etc. So the "git gc --auto" will happily do "git repack -A" or whatever, and that in turn does *nothing* what-so-ever (or rather, it packs my latest merge commit like the above and generates that pack of a whopping 8 objects).

I can fix it with "git gc --prune=now", so it's not like I personally really care, but since the whole point of "git gc --auto" is to allow people who don't know what they are doing to ignore the whole issue of GC and pruning, I do think this is a real UI bug.

I don't really have any suggestions for fixing it, though. Maybe we should make "git gc --auto" remove any unreachable objects? That would be potentially dangerous in shared repository situations, though. Or have an extra option to "git repack -A" to also pack any loose objects it finds at the end (whether reachable or not)?

                         Linus
Next: Ævar Arnfjörð Bjarmason
Message 1 of 18 in “git auto-repack is broken...”
  1. Linus TorvaldsDec 2, 2011
  2. Ævar Arnfjörð BjarmasonDec 2, 2011
  3. Linus TorvaldsDec 2, 2011
  4. Jeff KingDec 2, 2011
  5. Junio C HamanoDec 2, 2011
  6. Jeff KingDec 2, 2011
  7. Junio C HamanoDec 2, 2011
  8. Jeff KingDec 2, 2011
  9. Brandon CaseyDec 3, 2011
  10. Nicolas PitreDec 7, 2011
  11. Jeff KingDec 7, 2011
  12. Nicolas PitreDec 8, 2011
  13. Jeff KingDec 8, 2011
  14. Nicolas PitreDec 8, 2011
  15. Jeff KingDec 8, 2011
  16. Junio C HamanoDec 9, 2011
  17. Nicolas PitreDec 9, 2011
  18. Jeff KingDec 8, 2011

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.