Refactoring

This commit is contained in:
Naoki Takezoe
2014-04-25 10:38:34 +09:00
parent a104157c9a
commit 0e5591017a
5 changed files with 34 additions and 88 deletions

View File

@@ -585,4 +585,17 @@ object JGitUtil {
existIds.toSeq
}
def processTree(git: Git, id: ObjectId)(f: (String, CanonicalTreeParser) => Unit) = {
using(new RevWalk(git.getRepository)){ revWalk =>
using(new TreeWalk(git.getRepository)){ treeWalk =>
val index = treeWalk.addTree(revWalk.parseTree(id))
treeWalk.setRecursive(true)
while(treeWalk.next){
f(treeWalk.getPathString, treeWalk.getTree(index, classOf[CanonicalTreeParser]))
}
}
}
}
}