Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org,  Jeff King <peff@peff.net>,
	 Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 1/8] t/helper: add 'test-tool bitmap write' subcommand
Date: Tue, 14 Apr 2026 12:48:49 -0700	[thread overview]
Message-ID: <xmqqik9t9vby.fsf@gitster.g> (raw)
In-Reply-To: <d5ef6b959fd7c05c73bd33aa2b394558320aceac.1776124588.git.me@ttaylorr.com> (Taylor Blau's message of "Mon, 13 Apr 2026 19:56:40 -0400")

Taylor Blau <me@ttaylorr.com> writes:

> In f16eb1c091 (pseudo-merge: fix disk reads from find_pseudo_merge(),
> 2026-03-31), we noted that `apply_pseudo_merges_for_commit()` is never
> triggered by the existing test suite, and that this bears further
> investigation.
>
> This patch is the first one to begin that investigation. The following
> patches will expose and fix a variety of bugs in the implementation of
> pseudo-merge bitmaps.
>
> In order to do so, however, many of these tests require very precise
> selection of which commits receive bitmaps and which do not. To date,
> there isn't a standard approach to easily facilitate this. Address this
> by introducing a `test-tool bitmap write` subcommand that writes a
> bitmap for a given packfile, reading the set of commits which should
> receive individual bitmaps from stdin like so:
>
>     test-tool bitmap write <pack-basename> </path/to/commits.list
>
> , where "<pack-basename>" is the filename for a specific packfile (e.g.,
> "pack-abc123.pack"), and "/path/to/commits.list" is a list of commit
> OIDs which will receive bitmaps.
>
> The helper respects `bitmapPseudoMerge.*` configuration for creating
> pseudo-merge bitmaps alongside the regular commit bitmaps.
>
> Signed-off-by: Taylor Blau <me@ttaylorr.com>
> ---
>  t/helper/test-bitmap.c  | 110 +++++++++++++++++++++++++++++++++++++++-
>  t/t5310-pack-bitmaps.sh |  24 +++++++++
>  2 files changed, 133 insertions(+), 1 deletion(-)

I haven't been paying attention at all to pseudo-merge stuff, so my
comment may be too trivial and/or misses the point, but please bear
with me.

> diff --git a/t/t5310-pack-bitmaps.sh b/t/t5310-pack-bitmaps.sh
> index f693cb56691..9489e59fa55 100755
> --- a/t/t5310-pack-bitmaps.sh
> +++ b/t/t5310-pack-bitmaps.sh
> @@ -648,4 +648,28 @@ test_expect_success 'truncated bitmap fails gracefully (lookup table)' '
>  	test_grep corrupted.bitmap.index stderr
>  '
>  
> +test_expect_success 'test-tool bitmap write' '

It is very unclear what aspect of "test-tool bitmap write" is being
tested to me.  Let me think aloud to see if I can convey my
puzzlement.

> +	git init bitmap-write-helper &&
> +	test_when_finished "rm -fr bitmap-write-helper" &&

A tangent but the above two lines may want to be swapped.  "rm -fr"
does not fail when bitmap-write-helper directory does not yet exist,
so "prepare to clear anytime it fails from now on and then create"
would be a safer order than "create, and prepare to clear anytime it
fails from now on".

> +	(
> +		cd bitmap-write-helper &&
> +
> +		test_commit_bulk 64 &&
> +		git repack -ad &&
> +
> +		pack="$(ls .git/objects/pack/pack-*.pack)" &&

So we bulk-created 64 commits, repacked into one, and then

> +		git rev-parse HEAD >commits &&

wrote the tip-commit in "commits".

> +		test-tool bitmap write "$(basename $pack)" <commits &&

And told the new tool to write a bitmap file, with only that HEAD
commit and nothing else to get bitmap.

> +		test-tool bitmap list-commits | sort >actual &&
> +		sort commits >expect &&
> +		test_cmp expect actual &&

And compare the list of bitmapped commits with the singleton HEAD
(it is puzzling to sort a single element list, though).

> +		git rev-list --count --objects --use-bitmap-index HEAD >actual &&
> +		git rev-list --count --objects HEAD >expect &&
> +		test_cmp expect actual
> +	)
> +'
> +
>  test_done

If we look at the implementation of bitmap_write() below, the object
name for HEAD is fed to bitmap_write_push_commit() with pseudo bit
off.  After reading the list (which has only one element), we call
select_pseudo_merges().  What do we expect to happen in this call?
Since no bitmap_write_push_commit() call is made with pseudo bit on,
we will return immediately without doing anything?

After that bitmap_write_build() is called, and as this is expected
to add bitmaps to the commits fed to bitmap_write_push_commit(), we
are expecting to see bitmap given to HEAD (and nothing else)?

I said it is unclear what is being tested.  Putting it another way,
what could go wrong to cause this test to fail?  We give commit A,
B, and C to "bitmap write", and it somehow chooses other commits to
also give bitmap, which will be reported by "bitmap list-commits"
and we detect that as a failure?

Thanks.

  reply	other threads:[~2026-04-14 19:48 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-13 23:56 [PATCH 0/8] pack-bitmap: fix various pseudo-merge bugs Taylor Blau
2026-04-13 23:56 ` [PATCH 1/8] t/helper: add 'test-tool bitmap write' subcommand Taylor Blau
2026-04-14 19:48   ` Junio C Hamano [this message]
2026-04-14 21:29     ` Taylor Blau
2026-04-14 21:34       ` Junio C Hamano
2026-04-14 21:40         ` Taylor Blau
2026-04-14 20:08   ` Junio C Hamano
2026-04-14 21:40     ` Taylor Blau
2026-04-19  0:24   ` Elijah Newren
2026-04-21 18:51     ` Taylor Blau
2026-04-13 23:56 ` [PATCH 2/8] t5333: demonstrate various pseudo-merge bugs Taylor Blau
2026-04-19  0:25   ` Elijah Newren
2026-04-13 23:56 ` [PATCH 3/8] pack-bitmap-write: sort pseudo-merge commit lookup table in pack order Taylor Blau
2026-04-13 23:56 ` [PATCH 4/8] pack-bitmap: fix inverted binary search in `pseudo_merge_at()` Taylor Blau
2026-04-13 23:56 ` [PATCH 5/8] pack-bitmap: fix pseudo-merge lookup for shared commits Taylor Blau
2026-04-13 23:56 ` [PATCH 6/8] pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()` Taylor Blau
2026-04-13 23:56 ` [PATCH 7/8] pack-bitmap: reject pseudo-merge "sampleRate" of 0 Taylor Blau
2026-04-19  0:26   ` Elijah Newren
2026-04-13 23:57 ` [PATCH 8/8] pack-bitmap: prevent pattern leak on pseudo-merge re-assignment Taylor Blau
2026-04-21 20:01 ` [PATCH v2 0/9] pack-bitmap: fix various pseudo-merge bugs Taylor Blau
2026-04-21 20:01   ` [PATCH v2 1/9] t/helper: add 'test-tool bitmap write' subcommand Taylor Blau
2026-04-21 20:01   ` [PATCH v2 2/9] t5333: demonstrate various pseudo-merge bugs Taylor Blau
2026-04-21 20:02   ` [PATCH v2 3/9] pack-bitmap-write: sort pseudo-merge commit lookup table in pack order Taylor Blau
2026-04-21 20:02   ` [PATCH v2 4/9] pack-bitmap: fix inverted binary search in `pseudo_merge_at()` Taylor Blau
2026-04-21 20:02   ` [PATCH v2 5/9] pack-bitmap: fix pseudo-merge lookup for shared commits Taylor Blau
2026-04-21 20:02   ` [PATCH v2 6/9] pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()` Taylor Blau
2026-04-21 20:02   ` [PATCH v2 7/9] pack-bitmap: reject pseudo-merge "sampleRate" of 0 Taylor Blau
2026-04-21 20:02   ` [PATCH v2 8/9] Documentation: fix broken `sampleRate` in gitpacking(7) Taylor Blau
2026-04-21 20:02   ` [PATCH v2 9/9] pack-bitmap: prevent pattern leak on pseudo-merge re-assignment Taylor Blau
2026-04-22  1:37   ` [PATCH v2 0/9] pack-bitmap: fix various pseudo-merge bugs Elijah Newren
2026-05-11  2:53     ` Junio C Hamano
2026-05-12  0:48       ` Taylor Blau
2026-05-12  0:10     ` Taylor Blau
2026-05-12  0:46 ` [PATCH v3 " Taylor Blau
2026-05-12  0:46   ` [PATCH v3 1/9] t/helper: add 'test-tool bitmap write' subcommand Taylor Blau
2026-05-12  0:46   ` [PATCH v3 2/9] t5333: demonstrate various pseudo-merge bugs Taylor Blau
2026-05-12  0:46   ` [PATCH v3 3/9] pack-bitmap-write: sort pseudo-merge commit lookup table in pack order Taylor Blau
2026-05-12  0:46   ` [PATCH v3 4/9] pack-bitmap: fix inverted binary search in `pseudo_merge_at()` Taylor Blau
2026-05-12  0:47   ` [PATCH v3 5/9] pack-bitmap: fix pseudo-merge lookup for shared commits Taylor Blau
2026-05-12  0:47   ` [PATCH v3 6/9] pack-bitmap: parse commits in `find_pseudo_merge_group_for_ref()` Taylor Blau
2026-05-12  0:47   ` [PATCH v3 7/9] pack-bitmap: reject pseudo-merge "sampleRate" of 0 Taylor Blau
2026-05-12  0:47   ` [PATCH v3 8/9] Documentation: fix broken `sampleRate` in gitpacking(7) Taylor Blau
2026-05-12  0:47   ` [PATCH v3 9/9] pack-bitmap: prevent pattern leak on pseudo-merge re-assignment Taylor Blau
2026-05-12  1:38   ` [PATCH v3 0/9] pack-bitmap: fix various pseudo-merge bugs Junio C Hamano
2026-05-12  1:46     ` Taylor Blau
2026-05-12  1:49     ` Junio C Hamano

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=xmqqik9t9vby.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@ttaylorr.com \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /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