Subject: Re: [PATCH 3/3] pack-bitmap.c: use commit boundary during bitmap traversal

From: Taylor Blau <[email-masked]>
Date: Wed, 3 May 2023 17:42:25 -0400

On Tue, Apr 25, 2023 at 11:52:25AM -0700, Junio C Hamano wrote:
> Taylor Blau <[email-masked]> writes:
>
> >   3. Fall back to the ordinary object traversal if either (a) there are
> >      no haves, (b) none of the haves are in the bitmapped pack or MIDX,
> >      or (c) there are no wants.
>
> Tangents.  If there are no haves, wouldn't the answer by definition
> everything that are reachable from all wants?  Is there a reason why
> a bitmapped walk cannot fulfill such a request?  If there are no
> wants, wouldn't the answer by definition an empty set?  Again, I am
> not sure what the ordinary object traversal is expected to do in
> such a case.

Oops, (a) is just wrong. The old code is:

    /*
     * if we have a HAVES list, but none of those haves is contained
     * in the packfile that has a bitmap, we don't have anything to
     * optimize here
     */
    if (haves && !in_bitmapped_pack(bitmap_git, haves))
      goto cleanup;

which is itself an iffy optimization that I have toyed with the idea of
getting rid of over the years, since I am skeptical that it is doing
much even in the classic bitmap traversal.

But we only do that in_bitmapped_pack() if there are haves to begin
with, so (a) from my commit message is incorrect. Sorry about that.

> > And is more-or-less equivalent to using the *old* algorithm with this
> > invocation:
> >
> >     $ git rev-list --objects --boundary $WANTS --not $HAVES |
>
> It is especially confusing because the "--boundary" (at least as I
> originally had invented it), i.e. a commit that is smudged with
> UNINTERESTING bit, whose parent we did not bother to dig further to
> paint with the same UNINTERESTING bit, is not something we start our
> computation with; it is something we learn _after_ completing the
> history traversing.  So I am utterly confused X-<.

Hmm. This is from code that Peff and I wrote together a long time ago.
My recollection is that we only care about the UNINTERESTING commits
between the tips and boundary (as you described it), but no further, and
that we could discover that set during limit_list() alone.

But maybe not? I honestly cannot remember. Perhaps Peff does?

Thanks,
Taylor