{"thread":{"id":"66612","subject":"Partial-clone merge requests a locally created blob from the remote","startedAt":"2026-10-21T03:15:08Z","lastAt":"2026-10-21T03:15:08Z","messageCount":1,"participants":["Andrew Parmet"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"555645","messageId":"CADudEQNrfiP0VdYvxpWxNKZV=yXtc4LkSXPsmD++Bj8VRpXuQQ@mail.gmail.com","threadId":"66612","inReplyTo":null,"subject":"Partial-clone merge requests a locally created blob from the remote","fromName":"Andrew Parmet","fromEmail":"andrew@parmet.com","sentAt":"2026-10-21T03:15:08Z","receivedAt":"2026-10-21T03:15:08Z","isPatch":false,"sender":{"key":"andrew@parmet.com","avatar":null},"body":"Hello,\n\nI have a large repository where I have set up partial clones.\nOccasionally a merge fails with:\n\n    fatal: remote error: upload-pack: not our ref <object-id>\n    fatal: could not fetch <another-object-id> from promisor remote\n\nThe rejected object appears to be a blob created locally by the merge\nitself. After restoring the worktree to its pre-merge state and\nretrying the merge, it succeeds.\n\nWith some help from an LLM, I reduced this to a minimal reproducer\nbelow. The same script succeeds when I remove `--filter=blob:none`:\n\n---\n\n#!/bin/sh\n# Run with: sh /tmp/reproduce-promisor-merge.sh\n# Optional: REPRO_GIT=/path/to/git (and GIT_EXEC_PATH for a separate install).\n# Creates local temporary repositories only; retains them for inspection.\n# Expected: a clean merge. Affected Git: \"not our ref\", then exit 128.\nset -eu\n\ngit() { command \"${REPRO_GIT:-git}\" \"$@\"; }\nexport GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null\nexport GIT_AUTHOR_NAME=Reproducer GIT_AUTHOR_EMAIL=repro@example.invalid\nexport GIT_COMMITTER_NAME=\"$GIT_AUTHOR_NAME\"\nGIT_COMMITTER_EMAIL=\"$GIT_AUTHOR_EMAIL\"\n\nroot=$(mktemp -d \"${TMPDIR:-/tmp}/git-promisor-repro.XXXXXX\")\nprintf 'Repositories retained in: %s\\n' \"$root\"\ncd \"$root\"\n\n# With these contents, the local edit and merged result have blob IDs starting\n# with 6c. They share a loose-object directory, exposing its stale cache.\ncontents() { printf '%s 31\\n1\\n2\\n3\\n4\\n5\\n6\\n7\\n8\\n%s 31\\n' \"$1\" \"$2\"; }\n\ngit init -q --object-format=sha1 -b main server\ngit -C server config uploadpack.allowFilter true\ngit -C server config uploadpack.allowAnySHA1InWant true\ncontents top bottom > server/file.txt\ngit -C server add file.txt\ngit -C server commit -qm base\n\n# --no-local makes this local clone use the transport and honor blob filtering.\ngit clone -q --no-local --filter=blob:none server client\ngit -C client switch -qc topic\ncontents ours bottom > client/file.txt\ngit -C client commit -qam ours\n\n# The upstream edit is at the opposite end, so it merges without conflicts.\n# new.txt leaves a genuinely missing blob for the checkout fetch to obtain.\ncontents top theirs > server/file.txt\nprintf 'upstream only\\n' > server/new.txt\ngit -C server add .\ngit -C server commit -qm theirs\ngit -C client fetch -q origin\n\n# The bug requests the locally created merge result from the server, which\n# cannot have it. That rejects the batch also containing the new.txt blob.\nexport GIT_TRACE_PACKET=\"$root/packets.log\"\ngit -C client merge --no-edit origin/main\n\n---\n\nIs this a bug in git itself?\n\nThanks,\nAndrew Parmet\n\n"}]}