Re: [PATCH 0/4] Fix prune/gc problem with multiple worktrees
- From
Jeff King <peff@peff.net>
- Date
- Jun 1, 2016, 16:01 UTC
- Message-ID
- <20160601160143.GA9219@sigill.intra.peff.net>
- In-Reply-To
- <20160601104519.16563-1-pclouds@gmail.com>
On Wed, Jun 01, 2016 at 05:45:15PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 13 quoted lines
> This series makes sure that objects referenced by all worktrees are > marked reachable so that we don't accidentally delete objects that are > being used. Previously per-worktree references in index, detached HEAD > or per-worktree reflogs come from current worktree only, not all > worktrees. > > The series deals with git-prune and git-gc specifically. I left out > "git rev-list". It shares the same problem because it will only > consider current worktree's HEAD, index and per-worktree reflogs. The > problem is I am not sure if we simply just change, say > --indexed-objects, to cover all indexes, or should we only do that > with "--all-worktrees --indexed-objects". I guess this is up for > discussion.
I don't think touching reachable.c is enough. You also need to make sure that calling "git pack-objects --indexed-objects" will get them, too (otherwise they will be either ejected loose or dropped completely when --unpack-unreachable=2.weeks.ago or similar is used).
That code path uses rev-list internally. So I think you need something like "--all-worktrees --indexed-objects", and you need to pass the new option in from git-repack to pack-objects (or you need to simply make "--indexed-objects" cover all worktrees by default).
-Peff