Git development
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Elijah Newren <newren@gmail.com>,
	Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH 4/8] pack-bitmap: consolidate `find_object_pos()` success path
Date: Wed, 20 May 2026 16:42:37 +0200	[thread overview]
Message-ID: <ag3IXa3lKLmQC1tD@szeder.dev> (raw)
In-Reply-To: <c9a560660949c53575a9b1e81160d25212a1f484.1779207127.git.me@ttaylorr.com>

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

> return path between the packlist and MIDX cases.
> 
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
>  pack-bitmap-write.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
> index 651ad467469..6483fdc7daf 100644
> --- a/pack-bitmap-write.c
> +++ b/pack-bitmap-write.c
> @@ -224,23 +224,22 @@ static uint32_t find_object_pos(struct bitmap_writer *writer,
>  		if (writer->midx)
>  			base_objects = writer->midx->num_objects +
>  				writer->midx->num_objects_in_base;
> -
> -		if (found)
> -			*found = 1;
> -		return oe_in_pack_pos(writer->to_pack, entry) + base_objects;
> +		pos = oe_in_pack_pos(writer->to_pack, entry) + base_objects;
>  	} else if (writer->midx) {
> -		uint32_t at, pos;
> +		uint32_t at;
>  
>  		if (!bsearch_midx(oid, writer->midx, &at))
>  			goto missing;
>  		if (midx_to_pack_pos(writer->midx, at, &pos) < 0)
>  			goto missing;
> -
> -		if (found)
> -			*found = 1;
> -		return pos;
> +	} else {
> +		goto missing;
>  	}
>  
> +	if (found)
> +		*found = 1;
> +	return pos;
> +
>  missing:
>  	if (found)
>  		*found = 0;
> -- 
> 2.54.0.rc1.84.g30ce254312c
> 

  reply	other threads:[~2026-05-20 14:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 16:12 [PATCH 0/8] pack-bitmap-write: speed up bitmap generation Taylor Blau
2026-05-19 16:12 ` [PATCH 1/8] pack-bitmap: pass object position to `fill_bitmap_tree()` Taylor Blau
2026-05-19 16:12 ` [PATCH 2/8] pack-bitmap: check subtree bits before recursing Taylor Blau
2026-05-19 16:12 ` [PATCH 3/8] pack-bitmap: reuse stored selected bitmaps Taylor Blau
2026-05-19 16:12 ` [PATCH 4/8] pack-bitmap: consolidate `find_object_pos()` success path Taylor Blau
2026-05-20 14:42   ` SZEDER Gábor [this message]
2026-05-20 17:12     ` Taylor Blau
2026-05-19 16:12 ` [PATCH 5/8] pack-bitmap: cache object positions during fill Taylor Blau
2026-05-19 16:12 ` [PATCH 6/8] pack-bitmap: sort bitmaps before XORing Taylor Blau
2026-05-19 16:12 ` [PATCH 7/8] pack-bitmap: remember pseudo-merge parents Taylor Blau
2026-05-19 16:12 ` [PATCH 8/8] pack-bitmap: build pseudo-merge bitmaps after regular bitmaps Taylor Blau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ag3IXa3lKLmQC1tD@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    --cc=stolee@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox