jGit构造函数错误

jGit constructor error

在下面的代码中我得到了以下错误: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()

正如您在 docs RevWalk accepts an instance of Repository in constructor. Repository can be obtained from Git instance, have a look here 中看到的那样。