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

Re: [PATCH] repack: allow simultaneous packing and pruning

From
ETEran Tromer <git2eran@tromer.org>
Date
Oct 10, 2006, 23:45 UTC
Message-ID
<452C3092.7090003@tromer.org>
In-Reply-To
<Pine.LNX.4.64.0610101524050.3952@g5.osdl.org>
On 2006-10-11 00:27, Linus Torvalds wrote:
> Those unreferenced objects are old history that won't be part of any new 
> history.
> 
> If you create new history, they won't be in the pack.

... because git-repack moves only already-referenced objects to packs (and once they're referenced a subsequent "git-repack -a -d" won't lose them). Curiously, this critically depends on Documentation/git-repack being wrong:

  This script is used to combine all objects that do not currently
  reside in a "pack", into a pack.

However, this means there is no safe way to create a new pack without adding all its content as loose objects first.

For example, the following is racy because there's a point where the new pack is on disk but not yet referenced:

$ git-fetch --keep foo &  git-repack -a -d
>> But "git prune" does not GC packs, only loose objects.
> 
> Right. And you'd want to repack _and_ prune, but they should be kept 
> separate, because one is safe, the other is not.
Ah, semantics.

The request was for removing unreferenced objects ("pruning") in *packs* while doing the repacking. This turns out to be already implemented (contrary to the docs) and, as you explained, safe.

Pruning both packed and loose objects while repacking is neither safe nor requested (and is indeed roughly equivalent to just "git-repack -a -d; git-prune").

  Eran
Previous: Linus TorvaldsNext: Junio C Hamano
Message 8 of 9 in “repack: allow simultaneous packing and pruning”
  1. repack: allow simultaneous packing and pruningSam Vilain, Oct 10, 2006
  2. Sam VilainOct 10, 2006
  3. Linus TorvaldsOct 10, 2006
  4. Eran TromerOct 10, 2006
  5. Linus TorvaldsOct 10, 2006
  6. Eran TromerOct 10, 2006
  7. Linus TorvaldsOct 10, 2006
  8. Eran TromerOct 10, 2006
  9. Junio C HamanoOct 10, 2006

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.