I have a SHA-1 of a newly cloned repository. I want the author indent of this SHA-1.
So I need to use RevWalk and iterate the whole repository? Or is there a findXX
method or other code I can use to get the RevCommit
or another object that has the PersonIdent?
What I tried:
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();
}
}