Re: [PATCH 4/5] pack-objects: support excluded-open packs with --stdin-packs
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Mar 25, 2026, 23:19 UTC
- Message-ID
- <acRtj1ZualwdKwjz@nand.local>
- In-Reply-To
- <acAwZ1ARhvsTSpO5@nand.local>
On Sun, Mar 22, 2026 at 02:09:43PM -0400, Taylor Blau wrote:
Show 9 quoted lines
> 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