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

Recovering from gc errors

From
Marc Branchaud <marcnarc@xiplink.com>
Date
Nov 13, 2017, 21:13 UTC
Message-ID
<4f548c23-7bb5-a672-21bb-6c1dd6de6139@xiplink.com>
(I'm using git 2.15.0.)
So today "git gc" started complaining:

error: Could not read 2bc277bcb7e9cc6ef2ea677dd1c3dcd1f9af0c2b fatal: Failed to traverse parents of commit 9c355a7726e31b3033b8e714cf7edb4f0a41d8d4 error: failed to run repack

I suspect I'm a victim of the worktree+submodule bugs -- as a longtime user of contrib/workdir/git-new-workdir, I've been playing with the "worktree" command since it was first introduced. The "git gc" error occurs when it's run in my main repo; I have not tried it in any of my worktrees/workdirs.

Various incantations of "git show ... 9c355a7726e31" only fail with the same error, so I can't determine much about the problematic commit. Luckily I'm not particularly concerned with losing objects, as I push any important progress to named refs in backup repos.

But I would like to clean this up in my local repo so that gc stops failing. I tried simply removing this and other loose commits that trip up gc (i.e. the objects/9c/355a7726e31b3033b8e714cf7edb4f0a41d8d4 file -- there are 49 such files, all of which are several months old), but now gc complains of a bad tree object:

error: Could not read c1a99c3520f0b456b8025c50302a4cc9b0b2d777 fatal: bad tree object c1a99c3520f0b456b8025c50302a4cc9b0b2d777 error: failed to run repack

This object is not lying around loose. "git fsck" lists several dangling blob/commit/tree objects, but none of them are c1a99c3520f0b4.

So I'm not sure what to do next.
Any suggestions?
Thanks,
		M.
Next: Jeff King
Message 1 of 5 in “Recovering from gc errors”
  1. Marc BranchaudNov 13, 2017
  2. Jeff KingNov 14, 2017
  3. Marc BranchaudNov 14, 2017
  4. Eric SunshineNov 14, 2017
  5. Jeff KingNov 15, 2017

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.