@@ -2,12 +2,11 @@ package gitbucket.plugin.pages
22
33import gitbucket .core .controller .ControllerBase
44import gitbucket .core .service .{ AccountService , RepositoryService }
5- import gitbucket .core .util .ControlUtil ._
5+ import gitbucket .core .util .SyntaxSugars ._
66import gitbucket .core .util .{ Directory , JGitUtil , ReferrerAuthenticator }
77import org .eclipse .jgit .api .Git
88import org .eclipse .jgit .lib .ObjectId
99import org .eclipse .jgit .revwalk .RevCommit
10- import org .eclipse .jgit .treewalk .TreeWalk
1110
1211import scala .annotation .tailrec
1312import scala .language .implicitConversions
@@ -87,20 +86,5 @@ trait PagesControllerBase extends ControllerBase {
8786
8887 def isRoot (path : String ) = path == " "
8988
90- // copy&paste from RepositoryViewerControllerBase
91- private def getPathObjectId (git : Git , path : String , revCommit : RevCommit ): Option [ObjectId ] = {
92- @ scala.annotation.tailrec
93- def _getPathObjectId (path : String , walk : TreeWalk ): Option [ObjectId ] = walk.next match {
94- case true if walk.getPathString == path => Some (walk.getObjectId(0 ))
95- case true => _getPathObjectId(path, walk)
96- case false => None
97- }
98-
99- using(new TreeWalk (git.getRepository)) { treeWalk =>
100- treeWalk.addTree(revCommit.getTree)
101- treeWalk.setRecursive(true )
102- _getPathObjectId(path, treeWalk)
103- }
104- }
10589}
10690
0 commit comments