git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: "bad revision" fetch error when fetching missing objects from partial clones

From
Jeff King <peff@peff.net>
Date
May 13, 2021, 09:57 UTC
Message-ID
<YJz4JTsFjTtL7mE2@coredump.intra.peff.net>
In-Reply-To
<ba5a0574-c71c-709c-a13c-bf6d5981545c@jeffhostetler.com>
On Tue, May 11, 2021 at 02:44:52PM -0400, Jeff Hostetler wrote:
Show 15 quoted lines
> > > remote: ...<skipped>
> > > Receiving objects: 100% (64/64), 154.49 KiB | 2.97 MiB/s, done.
> > > remote: ...<skipped>
> > > Receiving objects: 100% (37/37), 168.35 KiB | 4.95 MiB/s, done.
> > > Resolving deltas: 100% (5/5), done.
> > > Resolving deltas: 100% (49/49), completed with 47 local objects.
> > > fatal: bad revision 'd5e9cd36ab21839af3d116eff3221c53f6ca7fd6'
> > > error: https://<myhost>/bagas/gitea.git did not send all necessary
> > > objects
> [...]
> 
> I'm not sure why you're getting that error, but you might
> also try enabling `uploadpack.allowAnySHA1InWant`
> (or one of the other "allow*SHS1InWant" values) and see if
> that helps.

That shouldn't be necessary these days, since the v2 protocol allows arbitrary objects to be fetched.

I think it is actually a bug with pack-objects not sending the object, but it only seems to trigger with bitmaps. This works:

  git init repo
  cd repo
  echo content >file
  git add file
  git commit -m base
  git config uploadpack.allowfilter true
  git clone --no-local --bare --filter=blob:none . clone
  cd clone
  git fetch origin $(git rev-parse HEAD:file)

But if I add a "git repack -adb" in the parent repository before the "cd clone", then I get:

  remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
  fatal: bad revision 'd95f3ad14dee633a758d2e331151e950dd13e4ed'
  error: /home/peff/tmp/repo/. did not send all necessary objects

So presumably this is a bug in the bitmap-aware filtering code that is not present in the regular filter-traversing code. But what really puzzles me is that the result seems totally broken. Yet the test coverage in t5310 passes, and nobody has noticed on major sites like GitHub (which supports partial clones and most certainly has bitmaps enabled).

So I think it will require some digging. My _guess_ is that it has to do with the "never filter out an object that was explicitly requested" rule not being consistently followed. But we'll see.

-Peff
Previous: Jeff HostetlerNext: Jeff King
Message 3 of 12 in “"bad revision" fetch error when fetching missing objects from partial clones”
  1. Bagas SanjayaMay 7, 2021
  2. Jeff HostetlerMay 11, 2021
  3. Jeff KingMay 13, 2021
  4. Jeff KingMay 13, 2021
  5. Jeff KingMay 14, 2021
  6. Patrick SteinhardtMay 17, 2021
  7. Jeff KingMay 17, 2021
  8. Derrick StoleeMay 17, 2021
  9. Jeff KingMay 18, 2021
  10. Bagas SanjayaMay 18, 2021
  11. Derrick StoleeMay 18, 2021
  12. Bagas SanjayaMay 15, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.