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

Re: Fwd: Possible git bug in commit-graph: "invalid commit position"

From
GOGary Oberbrunner <garyo@oberbrunner.com>
Date
Feb 4, 2020, 22:33 UTC
Message-ID
<CAFChFyhZYm88cCo6X_XikT=HRQG9Pp0vyveXmAuComFUJYjRcA@mail.gmail.com>
In-Reply-To
<d4313777-ce8c-0b64-997e-17cb719c9ab8@gmail.com>

Sorry for the long reply delay; the bug went away and only just showed up again. Here's the info you requested. I'm now running git 2.25.0.

Showing the bug:
% git show --patch df2f
fatal: invalid commit position. commit-graph is likely corrupt
commit df2f311c78b87d16509f352c66d7309957740711 (origin/feature/renderer)
Author: [redacted]
Date: Mon Jan 20 12:37:01 2020 -0500
WIP: add outline of back-end render web service

Submodule packages/ngl f713ed5..7de8821: %

Run "git commit-graph verify": doesn't detect any problem. % git commit-graph verify Verifying commits in commit graph: 100% (1/1), done. Verifying commits in commit graph: 100% (2/2), done. Verifying commits in commit graph: 100% (10/10), done. Verifying commits in commit graph: 100% (14/14), done. Verifying commits in commit graph: 100% (71/71), done. Verifying commits in commit graph: 100% (478/478), done

You asked me to delete .git/objects/info/commit-graph -- I don't have such a file, but I do have a subdir "commit-graphs": % ls .git/objects/info/commit-graphs/ commit-graph-chain graph-e96da2872d5c5fc1c4e399f99b7800d08fcdd273.graph graph-4f5807bbdcba22f8fdc081c91205c40d40e99d38.graph graph-e9f543a1389f8f5d6e91c09caa6658a1905d00fe.graph graph-79f0f3bff07f7e7dda9d2438a30ef6483a2b531f.graph tmp_graph_GHI48b graph-83ce268fda98e26938ce702bb261e1719ff816ba.graph tmp_graph_Ypgl2f graph-93a966dc8be3040189367f047f5111e9f29c2d6c.graph

After removing that subdir and running "git commit-graph write", I *do* have a .git/objects/info/commit-graph file.

The bug is still present though! However, I do have a git submodule
with its own .git/objects/info/commit-graphs; let's look into that.
In the git submodule dir, "git commit-graph verify" succeeds with no
errors (just like the parent).
Deleted the .git/objects/info/commit-graphs subdir, regenerated with
"git commit-graph write".
Retest original problem:
- Now the problem is fixed!

So long story short: the corrupted git commit-graph was in a submodule. It does appear that "git commit-graph verify" failed to detect the corruption. Removing and regenerating fixes it.

I do have the old git submodule's commit-graphs data in case it's useful. Let me know and I can send it along.

On Mon, Jan 20, 2020 at 7:37 PM Derrick Stolee <stolee@gmail.com> wrote:
Show 44 quoted lines
>
> On 1/20/2020 12:32 PM, Gary Oberbrunner wrote:
> > I'm running git 2.24.1 on Linux/WSL, and sometimes git fails with this error:
> > ```
> > % git diff --cached
> > fatal: invalid commit position. commit-graph is likely corrupt
> > ```
> > Usually that error goes away after I do a few more git operations, but
> > I haven't been able to discern a pattern yet. It's not always with
> > "diff", can be any git command as far as I can tell.
> > Perhaps it started after I enabled the commit-graph stuff:
> > ```
> > [core]
> >         editor = emacsclient -c -a \"\"
> >         preloadindex = true
> >         fscache = true
> >         autocrlf = false
> >         commitGraph = true
> >         writeCommitGraph = true
> > ```
> > In fact, when I turn off `commitGraph`, the error goes away. But as I
> > say, sometimes it goes away of its own accord.
>
> Disabling the featuere will definitely remove the error. Some commands may
> also just not "visit" the corrupt commit.
>
> > Googling turns up almost nothing on this error. I have no idea if I've
> > done something wrong to corrupt the commit graph, or if it's a git
> > bug. If there's anything I can do to help debug it, I'd be happy to --
> > just let me know.
>
> Please run "git commit-graph verify" to see if that catches the
> corruption. If not, then the verify feature is broken.
>
> Then, you can delete your .git/objects/info/commit-graph file
> and rebuild it with "git commit-graph write". (If you have
> fetch.writeCommitGraph enabled, then you may need to instead
> delete the .git/objects/info/commit-graphs directory.) If that
> process does not fix the problem, then there is definitely a bug
> in the feature. At the moment, it may just be a flipped bit in
> the file.
>
> Thanks,
> -Stolee
-- 
Gary
Previous: Derrick StoleeNext: Alex Riesen
Message 3 of 6 in “Fwd: Possible git bug in commit-graph: "invalid commit position"”
  1. Gary OberbrunnerJan 20, 2020
  2. Derrick StoleeJan 21, 2020
  3. Gary OberbrunnerFeb 4, 2020
  4. Alex RiesenMay 15, 2020
  5. Michael ForneyJun 21, 2020
  6. Derrick StoleeJun 22, 2020

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.