git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 08/10] pack-objects: introduce '--stdin-packs=follow-reachable'

From
Taylor Blau <me@ttaylorr.com>
Date
Jun 27, 2026, 00:41 UTC
Message-ID
<aj8cOhH6hGVZIFft@nand.local>
In-Reply-To
<xmqqpl1d56dd.fsf@gitster.g>
On Fri, Jun 26, 2026 at 02:39:10PM -0700, Junio C Hamano wrote:
Show 28 quoted lines
> Taylor Blau <me@ttaylorr.com> writes:
>
> > +/*
> > + * 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.

This should not be an &&, but rather an ||. We only want to handle objects which are either commits *or* tags via this function.

Show 14 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?

Hmm. You're right, if we have an unreachable annotated tag object in one of the STDIN_PACK_INCLUDE packs, then we'll pick it up and place it in the non-cruft pack.

I'd have to think more about how to handle this properly to ensure that *only* reachable objects are included. We probably want to re-order this code so that we start a traversal from the reference tips, then mark reachable objects as starting points based on whether or not they appear in an included pack (and correspondingly do not appear in an excluded one).

That adjusts how the traversal would work, I think, since we should be able to pick up the resulting set of objects in a single pass. But I'd have to think more about it...

Thanks, Taylor

Previous: Junio C HamanoNext: Junio C Hamano
Message 13 of 18 in “repack: combine '--geometric' and '--cruft'”
  1. 00/10 repack: combine '--geometric' and '--cruft'Taylor Blau, Jun 26, 2026
  2. 01/10 repack: unconditionally exclude non-kept packsTaylor Blau, Jun 26, 2026
  3. 03/10 repack: mark geometric progression of packs as retainedTaylor Blau, Jun 26, 2026
  4. 04/10 repack: teach MIDX retention about geometric rollupsTaylor Blau, Jun 26, 2026
  5. Junio C HamanoJun 26, 2026
  6. Taylor BlauJun 27, 2026
  7. 05/10 repack: delete geometric packs via existing_packsTaylor Blau, Jun 26, 2026
  8. 06/10 repack-geometry: drop unused redundant-pack removalTaylor Blau, Jun 26, 2026
  9. 02/10 repack: extract `locate_existing_pack()` helperTaylor Blau, Jun 26, 2026
  10. 07/10 pack-objects: extract `stdin_packs_add_all_pack_entries()`Taylor Blau, Jun 26, 2026
  11. 08/10 pack-objects: introduce '--stdin-packs=follow-reachable'Taylor Blau, Jun 26, 2026
  12. Junio C HamanoJun 26, 2026
  13. Taylor BlauJun 27, 2026
  14. Junio C HamanoJun 27, 2026
  15. Taylor BlauJun 27, 2026
  16. 09/10 pack-objects: support '--refs-snapshot' with 'follow-reachable'Taylor Blau, Jun 26, 2026
  17. 10/10 repack: support combining '--geometric' with '--cruft'Taylor Blau, Jun 26, 2026
  18. Junio C HamanoJul 27, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.