mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 13:05:50 +01:00
(refs #434)Refactor to get last modified commit
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user