Subject: Re: [PATCH v2] builtin/pack-objects.c: introduce `pack.extraCruftTips`

From: Taylor Blau <[email-masked]>
Date: Fri, 5 May 2023 20:14:29 -0400

On Fri, May 05, 2023 at 08:06:14PM -0400, Taylor Blau wrote:
> On Fri, May 05, 2023 at 05:23:22PM -0400, Jeff King wrote:
> > On Wed, May 03, 2023 at 05:22:04PM -0400, Taylor Blau wrote:
> >
> > > So it gets tricky when you have a pack.extraCruftTips program and want
> > > to invoke it in a non-pruning case. You could do something like:
> > >
> > >   - call enumerate_and_traverse_cruft_objects() *always*, either because
> > >     we were doing a pruning GC, or calling it after
> > >     `enumerate_cruft_objects()` (in the non-pruning case)
> > >
> > >   - ensure that enumerate_and_traverse_cruft_objects() is a noop when
> > >     (a) cruft_expiration is set to zero, and (b) there are no
> > >     pack.extraCruftTips programs specified
> >
> > I'm not sure why you'd need to traverse, though. If we are in "-k" mode,
> > we are keeping everything anyway (so I don't even see the point of
> > asking the helper about extra tips). And all of those objects that are
> > not reachable from the regular traversal are by definition "cruft" and
> > go into the cruft pack.
> >
> > Maybe I don't understand what you mean by "non-pruning" here.
>
> By non-pruning, I meant something like "git gc --prune=never", which
> would run the equivalent of `git repack -A` to generate the pack
> containing just reachable objects, and then invoke `git pack-objects
> --cruft` to generate the cruft pack.

Oops, my misunderstanding. I see what you're saying: in a `git gc
--prune=never`, it does not matter whether we ask for extra cruft tips,
since we're keeping all of those objects anyway. Duh.

Thanks,
Taylor