mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-05 04:56:02 +01:00
(refs #343)Retrieve all commit id from Git repository in pre commit hook instead of COMMIT_LOG table
This commit is contained in:
@@ -570,4 +570,16 @@ object JGitUtil {
|
||||
case e: MissingObjectException => None
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all commit id in the specified repository.
|
||||
*/
|
||||
def getAllCommitIds(git: Git): Seq[String] = {
|
||||
val existIds = new scala.collection.mutable.ListBuffer[String]()
|
||||
val i = git.log.all.call.iterator
|
||||
while(i.hasNext){
|
||||
existIds += i.next.name
|
||||
}
|
||||
existIds.toSeq
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user