threads / discuss / 58638

git gc error with git 2.37.2? (Introduced in 5a5ea141e7)

Subject: git gc error with git 2.37.2? (Introduced in 5a5ea141e7)

## tl;dr

3 messages between Oct 17, 2022 and Oct 17, 2022.

replies: 2people: 2as markdown or json

Paul Wagland· Oct 17, 2022, 17:10 UTC · lore
Hi all,
On git-users, I started a discussion(*) about a git gc error that I was getting that started with git 2.37.2. After some followup from Mathias on that list, I have determined that the issues that I a having started with the following commit:  https://github.com/git/git/commit/5a5ea141e7 ("revision: mark blobs needed for resolve-undo as reachable", 2022-06-09)
When I compile git locally with:
   git checkout dc8c8deaa6
   make
   git rev-list --objects --indexed-objects
Then it works.
   git checkout 5a5ea141e7
   make
   git rev-list --objects --indexed-objects
Then I get the error:
   fatal: missing blob object ‘1d0f34d1c4314efcff527847755e4ccc77d44fb6'
How can I further diagnose how to fix this?

Cheers, Paul

(*) discussion on git-users: https://groups.google.com/g/git-users/c/MKpmgpSC7xw/m/R5rLYDxJAgAJ
Jeff King· Oct 17, 2022, 17:42 UTC · re: Paul Wagland · lore

Re: git gc error with git 2.37.2? (Introduced in 5a5ea141e7)

On Mon, Oct 17, 2022 at 07:10:44PM +0200, Paul Wagland wrote:
Show 17 quoted lines
> On git-users, I started a discussion(*) about a git gc error that I was getting that started with git 2.37.2. After some followup from Mathias on that list, I have determined that the issues that I a having started with the following commit:  https://github.com/git/git/commit/5a5ea141e7 ("revision: mark blobs needed for resolve-undo as reachable", 2022-06-09)
> 
> When I compile git locally with:
>    git checkout dc8c8deaa6
>    make
>    git rev-list --objects --indexed-objects
> 
> Then it works.
> 
>    git checkout 5a5ea141e7
>    make
>    git rev-list --objects --indexed-objects
> 
> Then I get the error:
>    fatal: missing blob object ‘1d0f34d1c4314efcff527847755e4ccc77d44fb6'
> 
> How can I further diagnose how to fix this?

It sounds like there's a resolve-undo extension in your index that references that blob, but the blob was removed from the repository (probably by a gc prior to 5a5ea141e7, which was trying to prevent this corruption).

I'd expect that the resolve-undo extension would eventually be dropped once a merge is finished, but I'm not very familiar with that code. Is the repository in question mid-merge, or does it happen all the time?

If there are no changes you need to keep in the index or working tree, I expect that a workaround would be:

  rm -f .git/index
  git reset
  git update-index --refresh

to rewrite the index from scratch. Then the problem should not recur, as you'd be using a version with 5a5ea141e7 from here on out.

-Peff
Paul Wagland· Oct 17, 2022, 18:25 UTC · re: Jeff King · lore

Re: git gc error with git 2.37.2? (Introduced in 5a5ea141e7)

Hi Peff,
Show 13 quoted lines
> I'd expect that the resolve-undo extension would eventually be dropped
> once a merge is finished, but I'm not very familiar with that code. Is
> the repository in question mid-merge, or does it happen all the time?
> 
> If there are no changes you need to keep in the index or working tree,
> I expect that a workaround would be:
> 
>  rm -f .git/index
>  git reset
>  git update-index --refresh
> 
> to rewrite the index from scratch. Then the problem should not recur, as
> you'd be using a version with 5a5ea141e7 from here on out.
Thanks! This did the trick for me! I suspect that the problem happened at some point in the past, when I was doing a git merge and git gc concurrently. A whole whack of stuff required recovering at that point in time, and it all appeared to work with the old version. But probably something was still left in the index that referred to, indirectly, 1d0f34d1c.
My problem is now solved, I’ll also feed this back to git-users. Thanks!

Cheers, Paul

← back to recent threads