From: Junio C Hamano Date: Wed, 30 Sep 2026 17:51:12 GMT Subject: Re: [PATCH 2/4] pack-objects: ensure tree/tag closure with '--stdin-packs=follow' Message-ID: In-Reply-To: <6348667e2e3fe63aeb139888e877dd8447570253.1790731662.git.me@ttaylorr.com> Taylor Blau writes: > @@ -4574,6 +4603,9 @@ static int add_loose_object(const struct object_id *oid, const char *path, > > if (ctx && type == OBJ_COMMIT) > add_pending_oid(ctx->revs, NULL, oid, 0); > + else if (ctx && ctx->mode == STDIN_PACKS_MODE_FOLLOW && > + (type == OBJ_TREE || type == OBJ_TAG)) > + oid_array_append(&ctx->extra_roots, oid); > > return 0; > } Makes me wonder if this function will always end with "if ctx is not NULL, then depending on these conditions do one more thing" like this, or if it would change later. If the former, if (!ctx) return 0; if (type == OBJ_COMMIT) do the commit thing; else if (ctx->mode == follow && type in (tree, tag)) do the tag or tree thing; return 0; might be easier to follow, perhaps?