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

Re: git fetch --prune fails with "fatal: bad object"

From
Jeff King <peff@peff.net>
Date
Jun 6, 2024, 01:14 UTC
Message-ID
<20240606011453.GA623737@coredump.intra.peff.net>
In-Reply-To
<c2a02982-40a9-6629-05c2-c8de3335f35b@fastmail.fm>
On Wed, Jun 05, 2024 at 04:43:45PM -0700, Fred Long wrote:
Show 10 quoted lines
> On 6/5/2024 1:47 AM, Jeff King wrote:
> > 
> > Your local refs should not point to missing objects, though. Each clone
> > should maintain its own consistency. Are you using "git clone --shared"
> > or another scheme involving alternates?
> > 
> I use Google's "repo" script to manage Android repositories. The "repo"
> script runs "git repack -a -d", and I think that's what's removing the
> commits locally. Remotely, our bitbucket server removes commits that are no
> longer referenced.

Using "git repack -a -d" by itself should retain the objects that are reachable from your local refs/remotes/ refs. But I'd suspect that "repo" is doing something clever under the hood. I know there's some support for alternates, and a quick (hah!) "repo init && repo sync" on the android manifest shows that we end up symlinked objects directories. So there is ".repo/projects/foo.git" whose objects directory is a symlink to ".repo/project-objects/foo.git/objects".

I don't know how it is all supposed to work, but naively running "git repack -a -d" in the "project-objects" version risks corrupting the "projects" version, because it has no idea what refs are in the latter.

Certainly this warning is ominous:
  https://gerrit.googlesource.com/git-repo/+/refs/tags/v2.45/docs/internal-fs-layout.md#project-objects
-Peff
Previous: Fred LongNext: Fred Long
Message 11 of 16 in “git fetch --prune fails with "fatal: bad object"”
  1. Curley JoeMay 31, 2024
  2. Junio C HamanoMay 31, 2024
  3. rsbecker@nexbridge.comMay 31, 2024
  4. Junio C HamanoJun 1, 2024
  5. Jeff KingJun 4, 2024
  6. Junio C HamanoJun 4, 2024
  7. Jeff KingJun 5, 2024
  8. Fred LongJun 4, 2024
  9. Jeff KingJun 5, 2024
  10. Fred LongJun 5, 2024
  11. Jeff KingJun 6, 2024
  12. Fred LongJun 6, 2024
  13. Jeff KingJun 8, 2024
  14. Fred LongJun 8, 2024
  15. Jeff KingJun 11, 2024
  16. Fred LongJun 13, 2024

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.