在下面的代码中,我收到以下错误:Could not find matching constructor for: org.eclipse.jgit.revwalk.RevWalk(org.eclipse.jgit.api.Git)
。我想检查作者最后一次提交,如果它是John,则删除该文件。有什么问题?
def badAuthor = 'John'
def authorEqual() {
Git git = Git.open(new File(".git"))
RevCommit lastCommit = null;
try {
RevWalk walk = new RevWalk(git) --> HERE ERROR
RevCommit commit = walk.parseCommit(head.getObjectId());
PersonIdent aAuthort = commit.getAuthorIdent()
if(commit.getAuthorIdent().getWhen().equals(aAuthor == BadAuthor).compareTo(
lastCommit.getAuthorIdent().getWhen()) > 0)
lastCommit = commit
println commit
git.rm.call()
}
finally {
println "Commit ok"
}
}
authorEqual()