Skip to content

PackWriter produces duplicate objects in pack during bitmap walk with index misses #314

Open

Description

@Youtirsin

Version

7.7.1

Operating System

Linux/Unix

Bug description

When BitmapIndexImpl.CompressedBitmap.iterator() is used during a
bitmap walk with index misses (i.e. commits without precomputed
bitmaps that require RevWalk fallback), the same ObjectId can be
yielded twice: once from the mutableIndex range (position >=
indexObjectCount) and once from the ofObjectType range (position <
indexObjectCount).

PackWriter.addObject() inserts into objectsLists and objectsMap via
ObjectIdOwnerMap.add(), which does not check for duplicates. The
duplicate entry causes the object to be written to the pack twice.

This is reproducible on any repository where bitmap coverage is low
(e.g. an old repo with few selected commits in the bitmap) and midx
bitmap is enabled.

Actual behavior

The client fails with:

fatal: The same object appears twice in the pack
fatal: fetch-pack: invalid index-pack output

Clone/fetch is completely broken for the affected repository. 100%
reproducible, not a race condition.

Expected behavior

Clone/fetch should succeed. Each object should appear exactly once in
the pack regardless of bitmap coverage ratio.

Relevant log output

fatal: The same object 0021f932ac4d99e56d888832f024feee6318f1ad appears twice in the pack
fatal: fetch-pack: invalid index-pack output

Other information

No response

Activity

  1. Youtirsin commented on Nov 3, 2026

    @Youtirsin
    ContributorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions