From: "Google — Mergify" <remy.duthu@mergify.com>
To: git@vger.kernel.org
Cc: Patrick Steinhardt <ps@pks.im>, Junio C Hamano <gitster@pobox.com>
Subject: [BUG] partial clone lazy-fetches a blob it just wrote (bisected to 5946a564cd)
Date: Mon, 16 Nov 2026 12:45:52 +0100 [thread overview]
Message-ID: <69EF6B53-E153-46CC-B7EC-536BEBE8CF52@mergify.com> (raw)
Since Git 2.54.0, a cherry-pick in a blob:none partial clone can try to
lazy-fetch a blob that the cherry-pick has just written to the local
object store. The server never had that blob, so the fetch fails and the
command dies:
Auto-merging dev-tools/go.mod
Auto-merging go.mod
Auto-merging testing/go.mod
[bp fatal: remote error: upload-pack: not our ref 201d4490be49318c26485d10869070ae44d3e7ef
fatal: could not fetch 929ed29a43110d65cb7d581c4028e3f183088c3c from promisor remote
The commit itself has been written. The failure happens while the commit
summary is printed. 201d4490 is the result of the content merge of
dev-tools/go.mod. It is stored as a loose object in the clone, and
"git cat-file -t" with GIT_NO_LAZY_FETCH=1 reports it as a blob after
the failure.
Reproduction (needs network access to github.com, takes a few seconds):
git init -q repro && cd repro
git config core.repositoryformatversion 1
git config user.name t && git config user.email t@example.com
git remote add origin https://github.com/elastic/fleet-server
git config remote.origin.promisor true
git config remote.origin.partialclonefilter blob:none
git sparse-checkout set --no-cone --stdin </dev/null
git fetch --quiet --no-tags --depth=2 origin \
+refs/heads/9.4:refs/remotes/origin/9.4 \
8e9bf0673fe59a12c889b0c087319077c4138103
git checkout --quiet -b bp origin/9.4
git cherry-pick -x 8e9bf0673fe59a12c889b0c087319077c4138103
The 9.4 branch moves over time, so the exact object ids may change, but
the shape of the failure should not.
Results:
- Fails on 2.54.0, 2.55.0, 2.56.0, 2.56.1 and master (7fb6055e67).
- Succeeds on 2.47.3, 2.48.1, 2.50.1, 2.52.0 and 2.53.0.
- "git bisect" between v2.53.0 and v2.54.0 names:
5946a564cd odb/source: make `read_object_info()` function pluggable
My reading of that commit: before it, a lookup miss without
OBJECT_INFO_QUICK called odb_reprepare(), which also dropped the loose
object cache. Since then, the second read flushes only the packfile
store. The loose object cache is filled per fan-out directory and is
not updated when an object is written. So once a directory has been
scanned, a loose object written into it afterwards stays invisible to
OBJECT_INFO_QUICK lookups such as the OBJECT_INFO_FOR_PREFETCH check
in the diff prefetch. git then puts that object in the promisor fetch.
In the case above, the base blob of dev-tools/go.mod (2070e6a...) and the
merged blob (201d449...) share the "20/" directory, which fits.
To check this, I applied the change below on master. With it, the
reproduction succeeds:
--- a/odb/source-files.c
+++ b/odb/source-files.c
@@ static enum odb_read_status odb_source_files_read_object_info(
for (struct odb_files_dir *dir = files->dirs; dir; dir = dir->next) {
- if (retry)
+ if (retry) {
odb_source_prepare(&dir->packed->base, ODB_PREPARE_FLUSH_CACHES);
+ odb_source_prepare(&dir->loose->base, ODB_PREPARE_FLUSH_CACHES);
+ }
This is a check, not a proposed fix. Updating the loose cache when an
object is written may be the better fix. I'm happy to test patches
against this reproduction.
We run git this way in production (blob:none partial clones,
cherry-pick, merge-tree). This hit cherry-picks in several unrelated
public and private repositories, and on each repository it fails the
same way on every attempt. We have gone back to 2.53 until this is
fixed.
next reply other threads:[~2026-11-16 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 11:45 Google — Mergify [this message]
2026-11-16 12:46 ` [BUG] partial clone lazy-fetches a blob it just wrote (bisected to 5946a564cd) Patrick Steinhardt
[not found] ` <8F838F35-E5D5-4F6C-8835-99D1C040E0D4@mergify.com>
2026-11-16 20:16 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=69EF6B53-E153-46CC-B7EC-536BEBE8CF52@mergify.com \
--to=remy.duthu@mergify.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox