Subject: Re: [PATCH 4/5] pack-objects: support excluded-open packs with --stdin-packs

From: Taylor Blau <[email-masked]>
Date: Wed, 25 Mar 2026 19:19:43 -0400

On Sun, Mar 22, 2026 at 02:09:43PM -0400, Taylor Blau wrote:
> It's tempting to add something like:
>
>     if (!p)
>         BUG("add_object_entry_from_pack: expected non-NULL pack");
>
> But I wonder if we should instead store the result of calling
> `want_object_in_pack()` into a separate variable, only creating an
> object entry if "want == 1". That would have the effect of *not* marking
> objects as traversal tips if want_object_in_pack() makes `p` NULL.

I ended up talking myself out of this.

There's no reason to call want_object_in_pack() early, as it may change
the very pack pointer we wish to use to determine the object type of the
given object.

Once we have determined the object type, then we are free to call
want_object_in_pack() to determine if we want to add the object to the
resulting pack.

Thanks,
Taylor