Re: [PATCH v3 3/3] rev-list: add commit object support in `--missing` option
- From
Karthik Nayak <karthik.188@gmail.com>
- Date
- Oct 20, 2023, 11:14 UTC
- Message-ID
- <CAOLa=ZR4Qd9x-zVv9OtL7KTU00W2uT-kxdhKOLFZbi5cnHdiSQ@mail.gmail.com>
- In-Reply-To
- <xmqqttqmtcc2.fsf@gitster.g>
On Fri, Oct 20, 2023 at 1:35 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> > Junio C Hamano <gitster@pobox.com> writes: > > > Do we really need to allocate a new bit in the object flags, which > > is already a scarce resource? > > Clarification. I was *not* wondering if we can steal and (re|ab)use > a bit that is used for other purposes, in order to avoid allocating > a new bit. > > Rather, I was wondering if we need to use object flags to mark these > objects, or can do what we want to do without using any object flags > at all. For the purpose of reporting "missing" objects, wouldn't it > be sufficient to walk the object graph and report our findings as we > go? To avoid reporting the same object twice, as we reasonably can > expect that the missing objects are minority (compared to the total > number of objects), perhaps the codepath that makes such a report > can use a hashmap of object_ids or something, for example. >
This is kind of hard to do since the revision walking happens in revision.c and list-objects.c but the missing commits are needed in builtin/rev-list.c. So even if we build a list of missing commits in list-objects.c, there is no nice way to send this back to rev-list.c.
The only way we communicate between these layers is through callbacks, i.e. the show_commit() function in rev-list.c is called for every commit that the revision walk traverses over.
I'm not entirely sure what the best path to take here to be honest. I will look and see if there are any bits where overlapping doesn't cause any issues in the meantime.