diff --git a/pack-bitmap.c b/pack-bitmap.c index e8a82945cc..9c9b27b723 100644 --- a/pack-bitmap.c +++ b/pack-bitmap.c @@ -1559,7 +1559,7 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git, if (base) { int pos = bitmap_position(bitmap_git, &object->oid); - if (pos > 0 && bitmap_get(base, pos)) { + if (pos >= 0 && bitmap_get(base, pos)) { object->flags |= SEEN; continue; } diff --git a/t/t5333-pseudo-merge-bitmaps.sh b/t/t5333-pseudo-merge-bitmaps.sh index 305d677108..5b2a17f90a 100755 --- a/t/t5333-pseudo-merge-bitmaps.sh +++ b/t/t5333-pseudo-merge-bitmaps.sh @@ -50,7 +50,15 @@ test_expect_success 'bitmap traversal without pseudo-merges' ' test_pseudo_merges_cascades 0 merges && test_must_be_empty merges && - test_cmp expect actual + test_cmp expect actual && + + : >trace2.txt && + GIT_TRACE2_EVENT=$PWD/trace2.txt \ + git rev-list --objects --use-bitmap-index HEAD HEAD >/dev/null && + + # The first HEAD initializes base from its position-zero bitmap. The + # duplicate root should not count as another bitmap hit. + test_trace2_data bitmap bitmap/hits 1