如何从JGit的RevCommit获取作者日期和提交日期?

14

RevCommit有一个getCommitTime()方法,但它返回一个int并且没有作者时间。我怎样才能从RevCommit获取作者和提交日期?

1个回答

29

就像这样:

RevCommit commit = ...;

PersonIdent authorIdent = commit.getAuthorIdent();
Date authorDate = authorIdent.getWhen();
TimeZone authorTimeZone = authorIdent.getTimeZone();

PersonIdent committerIdent = commit.getCommitterIdent();
...

也可以查看API文档


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接