私は新しく複製されたリポジトリのSHA-1を持っています。著者はこのSHA-1をインデントしたい。jGit内の特定のSHA-1のコミットを取得します
私はRevWalkを使用してリポジトリ全体を反復処理する必要がありますか?または、メソッドや、私がRevCommit
やPersonIdentを持つ別のオブジェクトを取得するために使用できる他のコードがありますか?
public void authorInfoOf(Repository repo, AnyObjectId head) {
try {
try (RevWalk walk = new RevWalk(repo)) {
ObjectDatabase db = repo.getObjectDatabase();
ObjectLoader k = repo.newObjectReader().open(head);
ObjectReader s;
// repo.newObjectReader().open(head);
ObjectStream st = k.openStream();
// RevWalk rw2 = new RevWalk(k);
RevCommit commit = null;// walk.parseCommit(ref.getObjectId());
PersonIdent authorIndent = commit.getAuthorIdent();
System.out.println("\nCommit-Message: " + commit.getFullMessage() + " " + authorIndent.getEmailAddress());
}
} catch (Exception e) {
System.out.println("Authir info of Anybject id Err " + e);
e.printStackTrace();
}
}
可能な複製を(のhttp:// stackoverflow.com/questions/25755475/how-to-obtain-the-revcommit-or-objectid-from-a-sha1-id-string-with-jgit) –