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

`git gc` says "unable to read" but `git fsck` happy

From
SMStefan Monnier <monnier@iro.umontreal.ca>
Date
Mar 29, 2023, 22:05 UTC
Message-ID
<jwvfs9nusjm.fsf-monnier+Inbox@gnu.org>
Here's an example session:
    % LANG=C git fsck --strict; LANG=C git gc
    Checking object directories: 100% (256/256), done.
    error in tree 2699d230e3b592ae42506d7b5c969a7ac6a4593c: zeroPaddedFilemode: contains zero-padded file modes
    Checking objects: 100% (462555/462555), done.
    Verifying commits in commit graph: 100% (117904/117904), done.
    Enumerating objects: 462573, done.
    Counting objects: 100% (462573/462573), done.
    Delta compression using up to 8 threads
    Compressing objects: 100% (155363/155363), done.
    fatal: unable to read f5e44b38fc8f7e15e5e6718090d05b09912254fa
    fatal: failed to run repack
    %

How come it can't read `f5e44b38fc8f7e15e5e6718090d05b09912254fa` during "repack" while `git fsck` says everything is fine?

More importantly: how do I diagnose this further and fix it?

Rumors on the net suggest that `git gc --aggressive` may circumvent this problem occasionally, but those don't seem to know what they're talking about, and in my case it didn't make any difference (except that it takes more time :-).

        Stefan
Next: Jeff King
Message 1 of 5 in “`git gc` says "unable to read" but `git fsck` happy”
  1. Stefan MonnierMar 29, 2023
  2. Jeff KingMar 29, 2023
  3. Stefan MonnierMar 30, 2023
  4. Jeff KingMar 30, 2023
  5. Andreas SchwabJun 1, 2023

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.