Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JGit unable to read sha256 IDs #73

Open
BrotherPatrix opened this issue Jul 19, 2024 · 4 comments
Open

JGit unable to read sha256 IDs #73

BrotherPatrix opened this issue Jul 19, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@BrotherPatrix
Copy link

Version

6.10.0.202406032230-r

Operating System

Linux/Unix

Bug description

I'm having trouble in trying to work with a git repository using JGit and I believe that because this repository is with objectFormat sha256, this may break functionality.

Actual behavior

java.lang.RuntimeException: org.eclipse.jgit.api.errors.JGitInternalException: An exception occurred while trying to add the Id of HEAD
	at gss.dms.versioning.Versioning.useJGit(Versioning.java:119)
	at gss.dms.versioning.Versioning.calculateVersion(Versioning.java:85)
	at gss.dms.versioning.VersioningApplication.call(VersioningApplication.java:44)
	at gss.dms.versioning.VersioningApplication.call(VersioningApplication.java:16)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
	at picocli.CommandLine.execute(CommandLine.java:2174)
	at gss.dms.versioning.VersioningApplication.main(VersioningApplication.java:53)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: An exception occurred while trying to add the Id of HEAD
	at org.eclipse.jgit.api.LogCommand.call(LogCommand.java:135)
	at gss.dms.versioning.Versioning.useJGit(Versioning.java:98)
	... 12 more
Caused by: java.io.IOException: Cannot read file .../.git/packed-refs
	at org.eclipse.jgit.internal.storage.file.RefDirectory.readPackedRefs(RefDirectory.java:1003)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.refreshPackedRefs(RefDirectory.java:975)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.getPackedRefs(RefDirectory.java:966)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.firstExactRef(RefDirectory.java:353)
	at org.eclipse.jgit.lib.RefDatabase.findRef(RefDatabase.java:281)
	at org.eclipse.jgit.lib.Repository.findRef(Repository.java:1102)
	at org.eclipse.jgit.lib.Repository.resolve(Repository.java:815)
	at org.eclipse.jgit.lib.Repository.resolve(Repository.java:473)
	at org.eclipse.jgit.api.LogCommand.call(LogCommand.java:127)
	... 13 more
Caused by: org.eclipse.jgit.errors.InvalidObjectIdException: Invalid id: 6cd515c54340f94cd4150ef3653ca154c0fb2e010ea255017bc82c2ec156c056
	at org.eclipse.jgit.lib.ObjectId.fromString(ObjectId.java:203)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.parsePackedRefs(RefDirectory.java:1049)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.lambda$2(RefDirectory.java:994)
	at org.eclipse.jgit.util.FileUtils.readWithRetries(FileUtils.java:733)
	at org.eclipse.jgit.internal.storage.file.RefDirectory.readPackedRefs(RefDirectory.java:985)
	... 21 more

Expected behavior

I expected JGit to be able to read this .git folder.

Relevant log output

No response

Other information

I've done some research and it seems that this repository has object format sha256 instead of sha1 which leads me to believe that JGit does not support this hashing algorithm yet.

To further test this, I've installed the latest Eclipse 2024-06 available with EGit installed and I tried to add the project and I get the exact same errors.

Another bit of information that I can provide is that the repository was created using a Forgejo server and the person that created it confirmed that he selected sha256 as object format.

I've added this as a bug, because this is unclear to me if it was on a roadmap or not, but feel free to change it to a feature request.

@mitr15fan15v
Copy link

Missing Features
There are some missing features:

signing push
shallow and partial cloning
support for remote helpers
support for credential helpers
support for multiple working trees (git-worktree)
using external diff tools
support for HTTPS client certificates
SHA-256 object IDs
git protocol V2 (client side): packfile-uris
multi-pack index
split index

@msohn
Copy link
Member

msohn commented Jul 30, 2024

JGit doesn't yet support SHA-256 object IDs

@msohn msohn closed this as completed Jul 30, 2024
@theoparis
Copy link

Why is this closed if this is not implemented?

@msohn msohn added the enhancement New feature or request label Sep 23, 2024
@msohn
Copy link
Member

msohn commented Sep 23, 2024

reopened and marked as enhancement request

@msohn msohn reopened this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants