Partial-clone merge requests a locally created blob from the remote
- From
- Andrew Parmet <andrew@parmet.com>
- Date
- Oct 21, 2026, 03:15 UTC
- Message-ID
- <CADudEQNrfiP0VdYvxpWxNKZV=yXtc4LkSXPsmD++Bj8VRpXuQQ@mail.gmail.com>
Hello,
I have a large repository where I have set up partial clones. Occasionally a merge fails with:
fatal: remote error: upload-pack: not our ref <object-id>
fatal: could not fetch <another-object-id> from promisor remoteThe rejected object appears to be a blob created locally by the merge itself. After restoring the worktree to its pre-merge state and retrying the merge, it succeeds.
With some help from an LLM, I reduced this to a minimal reproducer below. The same script succeeds when I remove `--filter=blob:none`:
---
#!/bin/sh # Run with: sh /tmp/reproduce-promisor-merge.sh # Optional: REPRO_GIT=/path/to/git (and GIT_EXEC_PATH for a separate install). # Creates local temporary repositories only; retains them for inspection. # Expected: a clean merge. Affected Git: "not our ref", then exit 128. set -eu
git() { command "${REPRO_GIT:-git}" "$@"; } export GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null export GIT_AUTHOR_NAME=Reproducer GIT_AUTHOR_EMAIL=repro@example.invalid export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME" GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
root=$(mktemp -d "${TMPDIR:-/tmp}/git-promisor-repro.XXXXXX") printf 'Repositories retained in: %s\n' "$root" cd "$root"
# With these contents, the local edit and merged result have blob IDs starting # with 6c. They share a loose-object directory, exposing its stale cache. contents() { printf '%s 31\n1\n2\n3\n4\n5\n6\n7\n8\n%s 31\n' "$1" "$2"; }
git init -q --object-format=sha1 -b main server git -C server config uploadpack.allowFilter true git -C server config uploadpack.allowAnySHA1InWant true contents top bottom > server/file.txt git -C server add file.txt git -C server commit -qm base
# --no-local makes this local clone use the transport and honor blob filtering. git clone -q --no-local --filter=blob:none server client git -C client switch -qc topic contents ours bottom > client/file.txt git -C client commit -qam ours
# The upstream edit is at the opposite end, so it merges without conflicts. # new.txt leaves a genuinely missing blob for the checkout fetch to obtain. contents top theirs > server/file.txt printf 'upstream only\n' > server/new.txt git -C server add . git -C server commit -qm theirs git -C client fetch -q origin
# The bug requests the locally created merge result from the server, which # cannot have it. That rejects the batch also containing the new.txt blob. export GIT_TRACE_PACKET="$root/packets.log" git -C client merge --no-edit origin/main
---
Is this a bug in git itself?
Thanks, Andrew Parmet