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