【发布时间】:2018-02-20 09:20:08
【问题描述】:
我正在尝试使用 JGit 从存储库中特定提交的自定义 ref refs/notes/abcd 读取 Git Notes 信息
这是我尝试过的:
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"));
我收到以下编译错误:
错误:不兼容的类型:org.eclipse.jgit.lib.ObjectId 无法转换为 org.eclipse.jgit.revwalk.RevObject
如果给定一个 commit-sha 字符串,我如何将 RevObject 变量传递给 Git setObjectId()?
【问题讨论】: