Community
Participate
Working Groups
We're encountering an issue with DirCache when upgrading git to 2.40. After switching branches with this git version a call to DirCache.read(org.eclipse.jgit.lib.Repository) for a large repo consistently fails with: Exception in thread "main" org.eclipse.jgit.errors.CorruptObjectException: DIRC checksum mismatch at org.eclipse.jgit.dircache.DirCache.readFrom(DirCache.java:547) at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:406) at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:191) at org.eclipse.jgit.dircache.DirCache.read(DirCache.java:163) The exact repo config is new FileRepositoryBuilder().findGitDir(repoFile).setWorkTree(repoFile).build() A functional workaround is to change (back) to git 2.37 and either switch branch again or run git update-index --index-version 4 && git update-index --really-refresh One possibly related point in the git 2.40 release notes (https://lwn.net/Articles/926033/) is: * Use the SHA1DC implementation on macOS, just like other platforms, by default. Though I'm not sure whether this would be used for more than literal collision detection. This is on M1 macs running Ventura 13.2.1 on JVM 11 and was reproduced both on JGit 5.13 and 6.5 (not available in Version selection). Thanks!
This error occurs when the new option index.skipHash [1] is set to true. JGit doesn't recognise this option yet and hence doesn't expect the index checksum to be a set of null-bytes if this option is turned on. Setting this option to false and recreating the git index can workaround this problem until a fix is available. [1] https://git-scm.com/docs/git-config#Documentation/git-config.txt-indexskipHash
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/200916
New Gerrit change created: https://git.eclipse.org/r/c/jgit/jgit/+/200948
Gerrit change https://git.eclipse.org/r/c/jgit/jgit/+/200916 was merged to [stable-5.13]. Commit: http://git.eclipse.org/c/jgit/jgit.git/commit/?id=23b9693a75b899c97da8a04c0b531874b225d236
Hello, I just have two questions about this fix. 1) the ticket mentions MAC. does this also impact windows? 2) if it does impact windows also, it this fix included on the latest download I see of 2.40.1?
2 questions about this ticket. 1) ticket mentions mac impact. does it also impact windows? 2) if windows is impacted, is the fix included in version 2.40.1 (latest availabe on site for download) Thank you.
(In reply to Mark Fishman from comment #6) > 2 questions about this ticket. > > 1) ticket mentions mac impact. does it also impact windows? > > 2) if windows is impacted, is the fix included in version 2.40.1 (latest > availabe on site for download) > > Thank you. This is a problem in JGit, not in git 2.40. If you run into this problem with JGit, the work-around is to set git config index.skipHash to false. Since this an interoperability issue between JGit and git.2.40 or newer, it occurs on all platforms when JGit is used on a git repository that has been manipulated by git 2.40 or newer.
thank you for the information. looks like I get the jgit exception switching branches in eclipse. can you tell me how to set that index.skipHash you mentioned and if there are any repercussions to doing so?
(In reply to Mark Fishman from comment #8) > thank you for the information. > > looks like I get the jgit exception switching branches in eclipse. > > can you tell me how to set that index.skipHash you mentioned and if there > are any repercussions to doing so? Set index.skipHash in the git config, either in the repository or in the global user config. Or if you are using Eclipse 2022-12 or newer: update to EGit nightly; it should have the JGit fix for this issue. EGit nightly can be installed from https://download.eclipse.org/egit/updates-nightly .
(In reply to Thomas Wolf from comment #9) > (In reply to Mark Fishman from comment #8) > > thank you for the information. > > > > looks like I get the jgit exception switching branches in eclipse. > > > > can you tell me how to set that index.skipHash you mentioned and if there > > are any repercussions to doing so? > > Set index.skipHash in the git config, either in the repository or in the > global user config. > > Or if you are using Eclipse 2022-12 or newer: update to EGit nightly; it > should have the JGit fix for this issue. > > EGit nightly can be installed from > https://download.eclipse.org/egit/updates-nightly . Hi Thomas, Just wanted to let you know that that fixed our issue. Thank you so much for the help. Really appreciate it.