1
在下面的代碼中,我得到了以下錯誤:Could not find matching constructor for: org.eclipse.jgit.revwalk.RevWalk(org.eclipse.jgit.api.Git)
。我想檢查作者最後的提交,如果它是約翰,刪除該文件。哪裏不對?jGit構造函數錯誤
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()
請問您可以試試:'RevWalk walk = new RevWalk(git.repository)'? – Opal
是的,就是這樣。謝謝 –