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

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

From
Andreas Schwab <schwab@suse.de>
Date
Jun 1, 2023, 12:04 UTC
Message-ID
<mvm4jnr9yn6.fsf@suse.de>
In-Reply-To
<20230330181716.GA3286761@coredump.intra.peff.net>
On Mär 30 2023, Jeff King wrote:
Show 16 quoted lines
> On Thu, Mar 30, 2023 at 09:01:39AM -0400, Stefan Monnier wrote:
>
>> > If it is the same problem (which would be a blob or maybe cached tree
>> > missing in one of the worktree's index files), then probably you'd
>> > either:
>> >
>> >   1. Accept the loss and blow away that worktree's index file (or
>> >      perhaps even the whole worktree, and just recreate it).
>> 
>> Hmm... the problem is "that": I have about a hundred worktrees for
>> this repository.
>> But yes, I can just throw away all those `index` files, I guess.
>
> If you try "git fsck" from the tip of master, it should identify the
> worktree index that is the source of the problem, I think. You might
> need to pass "--name-objects".

I had the same problem, and after Junio refreshed my memory by pointing me to this thread, I updated to the brand new git 2.41 and re-ran git fsck. That duely identified problems in two of the worktree indexes (invalid sha1 pointer in resolve-undo). After recreating those indexes there were no more complaints from git gc.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
Previous: Jeff King
Message 5 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.