1

是否有用于 git 的 java api,它允许从存储库中获取 git 注释?我查看了http://server001.agilebackoffice.org/nexus/content/repositories/atlassian/com/xiplink/jira/git/jira-git-plugin/0.6/但它似乎不支持 git 笔记。任何想法在哪里寻找?

4

1 回答 1

1

JGit可能有您正在寻找的东西,特别是http://download.eclipse.org/jgit/docs/latest/apidocs/org/eclipse/jgit/notes/NoteMap.html

例如,可以通过以下方式查找特定提交的注释:

Repository repo = ...

RevWalk walk = new RevWalk(repo);
NoteMap map = NoteMap.newEmptyMap();
Ref ref = repo.getRef("refs/notes/commits");

if (ref != null) {
  RevCommit notesCommit = walk.parseCommit(ref.getObjectId());
  map = NoteMap.read(walk.getObjectReader(), notesCommit);
  map.getNote(notesCommit.getId());
}
于 2013-09-10T09:55:35.050 回答