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

Re: git auto-repack is broken...

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Dec 2, 2011, 16:56 UTC
Message-ID
<CA+55aFyq28vmo9dk-5mVm+nNn86qSjNT6VJGc09iaJo=+OP1Sg@mail.gmail.com>
In-Reply-To
<CACBZZX7Q5qb1r_Oh0QfMiWh9UAM1c6QWBn4abv-xHpFBaKuyKg@mail.gmail.com>

On Fri, Dec 2, 2011 at 8:27 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 9 quoted lines
>
>> Maybe we should make "git gc --auto" remove any unreachable objects?
>
> Wouldn't that mean that any loose commit objects you have lying around
> would be removed by the automatic git gc?
>
> One feature of git that I personally rely on is that I can liberally
> move heads around / make commits on detached heads and not have those
> commits gc'd unless I explicitly ask for it for a while.

Well, with reflogs, you actually do have those objects reachable for quite a while (90 days by default).

The "unreachable objects" tends to happen when you do fetches without ever merging the result or actually remove branches (and/or expiring the reflogs early etc). Not from the normal "use 'git reset' and friends to move heads around".

That said, I do agree that removing loose objects is the much less safe approach.

Of course, repacking the objects results in problems too: now you've entirely lost the age information for that object, so now you cannot prune it based on age any more.

But leaving the loose objects around and basically failing auto-gc isn't good either.

                     Linus
Previous: Ævar Arnfjörð BjarmasonNext: Jeff King
Message 3 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.