Re: [PATCH 3/7] pack-bitmap: allow aborting iteration of bitmapped objects
- From
Jeff King <peff@peff.net>
- Date
- Jul 11, 2026, 07:47 UTC
- Message-ID
- <20260711074723.GB1457061@coredump.intra.peff.net>
- In-Reply-To
- <alCafO91ZtFdikPg@pks.im>
On Fri, Jul 10, 2026 at 09:08:44AM +0200, Patrick Steinhardt wrote:
Show 22 quoted lines
> On Thu, Jul 09, 2026 at 03:19:52PM -0500, Justin Tobler wrote: > > > diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c > > > index ea5eab4cf8..8ff92c5272 100644 > > > --- a/builtin/pack-objects.c > > > +++ b/builtin/pack-objects.c > > > @@ -1909,7 +1909,7 @@ static int add_object_entry_from_bitmap(const struct object_id *oid, > > > return 0; > > > > > > create_object_entry(oid, type, name_hash, 0, 0, pack, offset); > > > - return 1; > > > + return 0; > > > > I wonder why this was even returning 1 to begin with? As you mentioned, > > the return value appears to be ignored anyways. I'm assuming it was > > signal that an object entry was created? > > The function is only called from a single location, and the return value > was completely ignored until this commit. It has always been this way > since the function was originally introduced in 6b8fda2db1 > (pack-objects: use bitmaps when packing objects, 2013-12-21), so it > never seemed to have any purpose. The commit message doesn't mention > anything either.
I think it was copying the semantics of its non-bitmap counterpart, add_object_entry(). Of course nobody looks at that return value either!
Long ago there were callers that cared about whether we actually created an entry, but I think the last one went away in 5379a5c5ee (Thin pack generation: optimization., 2006-04-05), which was quite some time ago.
So I think we could probably drop the return value from add_object_entry() entirely (but of course we can't do the same for the bitmap variant, because of its use as a callback).
I mention this mostly as answering Justin's "I wonder why...", but it might be worth cleaning up add_object_entry() here, as its return value semantics have diverged from add_object_entry_from_bitmap().
-Peff