Re: [RFC PATCH 08/10] pack-objects: introduce '--stdin-packs=follow-reachable'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 26, 2026, 21:39 UTC
- Message-ID
- <xmqqpl1d56dd.fsf@gitster.g>
- In-Reply-To
- <e3d2e46443d0b32ce29215563dde04ebcf850679.1782500507.git.me@ttaylorr.com>
Taylor Blau <me@ttaylorr.com> writes:
Show 24 quoted lines
> +/*
> + * Flag bit set on commits that belong to an included pack during
> + * '--stdin-packs=follow-reachable'. Used by the pre-walk to
> + * identify which reachable commits should be tips for the main
> + * object traversal.
> + */
> +#define IN_INCLUDED_PACK (1u<<11)
> +
> +static int mark_included_pack_tip(const struct object_id *oid,
> + struct packed_git *p,
> + uint32_t pos,
> + void *data)
> +{
> + struct rev_info *main_revs = data;
> + off_t ofs = nth_packed_object_offset(p, pos);
> + enum object_type type;
> + struct object_info oi = OBJECT_INFO_INIT;
> + struct object *obj;
> +
> + oi.typep = &type;
> + if (packed_object_info(p, ofs, &oi) < 0)
> + return 0;
> + if (type != OBJ_COMMIT && type != OBJ_TAG)
> + return 0;We do not care about non commits, non tags.
Show 8 quoted lines
> + obj = parse_object(the_repository, oid); > + if (!obj) > + return 0; > + > + obj->flags |= IN_INCLUDED_PACK; > + > + if (type == OBJ_TAG && main_revs) > + add_pending_object(main_revs, obj, "");
Any tag object is added to the pending list of the second phase traversal here. Doesn't this retain unreachable tags and (unreachable) objects that are only reachable from these unreachable tags found in the packfile? Don't we want to limit this code to add only tags that actually are reachable from refs, or something?
> + return 0; > +}
The other function ...
> +static int mark_loose_object_tip(const struct object_id *oid, > + struct object_info *oi UNUSED, > + void *data)
... is structured in a very similar way, and gives the same puzzlement to me.