java - How to read Git notes using JGit given a commit-sha -
i trying read git notes information custom ref refs/notes/abcd
of particular commit in repository using jgit
here tried:
repository repository = repositorymanager.openrepository(reponame); git git = new git(repository); objectid oid = repository.resolve("5740b142a7b5f66768a2d904b267dccaef1a095f"); note note = git.notesshow().setnotesref("refs/notes/abcd").setobjectid(oid).call(); objectloader loader = repository.open(note.getdata()); byte[] data = loader.getbytes(); system.out.println(new string(data, "utf-8"));
i following compilation error:
error: incompatible types: org.eclipse.jgit.lib.objectid cannot converted org.eclipse.jgit.revwalk.revobject
how pass revobject
variable git setobjectid()
given commit-sha string?
with revwalk
, object id can parsed , resulting revcommit
can passed shownotecommand
.
for example:
revcommit commit; try( revwalk revwalk = new revwalk( repository ) ) { commit = revwalk.parsecommit( oid ); } git.notesshow().setobjectid( commit )...
Comments
Post a Comment