Re: [External] Re: [PATCH 1/1] revision: don't set parents as uninteresting if exclude promisor objects
- From
韩仰 <hanyang.tony@bytedance.com>
- Date
- Aug 12, 2024, 12:34 UTC
- Message-ID
- <CAG1j3zEQh3xujrU3tGOftwvCZ+d9RjvMHw8v4W3dqd3DsiGCUQ@mail.gmail.com>
- In-Reply-To
- <xmqq4j82euvr.fsf@gitster.g>
On Sat, Aug 3, 2024 at 12:45 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
> > diff --git a/revision.c b/revision.c
> > index 1c0192f522..eacb0c909d 100644
> > --- a/revision.c
> > +++ b/revision.c
> > @@ -1164,7 +1164,7 @@ static int process_parents(struct rev_info *revs, struct commit *commit,
> > * wasn't uninteresting), in which case we need
> > * to mark its parents recursively too..
> > */
> > - if (commit->object.flags & UNINTERESTING) {
> > + if (!revs->exclude_promisor_objects && commit->object.flags & UNINTERESTING) {
> > while (parent) {
> > struct commit *p = parent->item;
> > parent = parent->next;
>
> But if the iteration is over all objects in certain packfiles to
> mark them all uninteresting, shouldn't the caller avoid the call to
> process_parents() in the first place? Letting process_parents() to
> do other things and only refrain from doing the "this commit is
> marked uninteresting" part does not quite match what you are trying
> to do, at least to me.Thanks, I agree process_parents() isn't the right place to fix the issue.
Show 7 quoted lines
> It apepars to me that its approach to exclude the objects that > appear in the promisor packs may be sound, but the design and > implementation of it is dubious. Shouldn't it be getting the list > of objects with get_object_list() WITHOUT paying any attention to > --exclude-promisor-objects flag, and then filtering objects that > appear in the promisor packs out of that list, without mucking with > the object and commit traversal in revision.c at all?
The problem is --exclude-promisor-objects is an option in revision.c, and this option is used by pack-objects, prune, midx-write and rev-list. I see there are two ways to fix this issue, one is to remove the --exclude-promisor-objects from revision.c, and filter objects in show_commit or show_objects functions. The other place to filter objects is probably in revision walk, maybe in traverse_commit_list?
Thanks.