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

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

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 10, 2006, 15:03 UTC
Message-ID
<Pine.LNX.4.64.0610100800490.3952@g5.osdl.org>
In-Reply-To
<20061010102210.568341380D6@magnus.utsl.gen.nz>
On Tue, 10 Oct 2006, Sam Vilain wrote:
Show 5 quoted lines
>
> If using git-repack -a, unreferenced objects are kept behind in the
> pack.  This might be the best default, but there are no good ways
> to clean up the packfiles if a lot of rebasing is happening, or
> branches have been deleted.
Don't do this.
I understand why you want to do it, but the fact is, it's dangerous.

Right now, "git repack" is actually safe to run even on a repository which is being modified! And that's actually important, if you have something like a shared repo that gets re-packed every once in a while from a cron-job!

So the refs might be up-dated as it runs, and if that happens, your pruning doesn't really do the right thing - it might consider a new loose object to be unreachable, because it didn't check whether the refs have changed since it read them so that it might actually _be_ reachable after all.

So please don't do this. 

It's important for operations to always think about "what happens if somebody does a 'commit' or pushes into the tree at the same time?".

For example, the "git prune-packed" that gets run afterwards is _not_ racy, because it will only prune objects that already exist in the pack.

		Linus
Previous: Sam VilainNext: Eran Tromer
Message 3 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.