🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.git
1 messages
1 total messages Started by Andrew Parmet Wed, 21 Oct 2026 03:15
Partial-clone merge requests a locally created blob from the remote
#979
Author: Andrew Parmet
Date: Wed, 21 Oct 2026 03:15
71 lines
10691 bytes
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 remote

The 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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads