Skip to content

pr-1711/blanet/xx/midx-ignore-replace-objects-v1

From: Xing Xin <xingxin.xx@bytedance.com>

We observed a series of clone failures arose in a specific set of
repositories after we fully enabled the MIDX bitmap feature within our
Codebase service. These failures were accompanied with error messages
such as:

  fatal: did not receive expected object ...
  fatal: fetch-pack: invalid index-pack output

Temporarily disabling the MIDX feature eliminated the reported issues.
After some investigation we found that all repositories experiencing
failures contain replace references, which seem to be improperly
acknowledged by the MIDX bitmap generation logic. During cloning or
fetching, git-pack-objects, which may make use of MIDX bitmap to find
objects to pack, would give wrong objects even if we explicitly
specified not to enable replace refs by GIT_NO_REPLACE_OBJECTS=1.
Indeed, this issue appears to have persisted since the introduction of
MIDX.

This patch updates the MIDX logic to disable replace objects during
operations, mirroring the handling seen in single pack index scenarios,
i.e. git-index-pack and git-pack-objects. The added test uses
git-rev-list to give a more intuitive check.

Signed-off-by: Xing Xin <xingxin.xx@bytedance.com>

Submitted-As: https://lore.kernel.org/git/pull.1711.git.1712495507815.gitgitgadget@gmail.com
Assets 2