Subject: Re: [PATCH 4/8] pack-bitmap: consolidate `find_object_pos()` success path

From: Taylor Blau <[email-masked]>
Date: Wed, 20 May 2026 13:12:26 -0400

On Wed, May 20, 2026 at 04:42:37PM +0200, SZEDER Gábor wrote:
> On Tue, May 19, 2026 at 12:12:44PM -0400, Taylor Blau wrote:
> > Both sides of `find_object_pos()` report success in the same way by
> > setting the optional `found` out-parameter and return the resolved
> > bitmap position.
> >
> > Prepare for adding more bookkeeping around object-position lookups by
> > storing the result in a local `pos` variable and sharing the success
>
> This 'pos' variable will only be declared in the next commit,
> resulting in an error building this commit:
>
>   pack-bitmap-write.c: In function ‘find_object_pos’:
>   pack-bitmap-write.c:227:17: error: ‘pos’ undeclared (first use in this function)
>     227 |                 pos = oe_in_pack_pos(writer->to_pack, entry) + base_objects;
>         |                 ^~~
>   pack-bitmap-write.c:227:17: note: each undeclared identifier is reported only once for each function it appears in
>   make: *** [Makefile:2917: pack-bitmap-write.o] Error 1

Thanks for spotting. I had split the patch that immediately follows this
one into two to make the latter easier to read, but have no idea how
this snuck through.

It's fixed by declaring `pos` in this commit:

--- 8< ---
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 6483fdc7daf..42ed22feacc 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -217,6 +217,7 @@ static uint32_t find_object_pos(struct bitmap_writer *writer,
 				const struct object_id *oid, int *found)
 {
 	struct object_entry *entry;
+	uint32_t pos;

 	entry = packlist_find(writer->to_pack, oid);
 	if (entry) {
--- >8 ---

, but I'll send a re-roll after the rest of the series has been
reviewed.

Thanks,
Taylor