(refs #434)Refactor to get last modified commit

This commit is contained in:
Tomofumi Tanaka
2014-08-24 22:15:31 +09:00
parent db59bc08ac
commit d947410e3c
2 changed files with 13 additions and 2 deletions

View File

@@ -652,4 +652,15 @@ object JGitUtil {
}.head.id
}
/**
* Returns the last modified commit of specified path
* @param git the Git object
* @param startCommit the search base commit id
* @param path the path of target file or directory
* @return the last modified commit of specified path
*/
def getLastModifiedCommit(git: Git, startCommit: RevCommit, path: String): RevCommit = {
return git.log.add(startCommit).addPath(path).setMaxCount(1).call.iterator.next
}
}