mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
Fixed updating temporary files for branches.
This commit is contained in:
@@ -133,18 +133,20 @@ class RepositoryViewerServlet extends ScalatraServlet with ServletBase {
|
|||||||
val git = Git.open(dir)
|
val git = Git.open(dir)
|
||||||
|
|
||||||
val branchList = git.branchList.call.toArray.map { ref =>
|
val branchList = git.branchList.call.toArray.map { ref =>
|
||||||
ref.asInstanceOf[Ref].getName.replaceFirst("^refs/heads/", "")
|
ref.asInstanceOf[Ref].getName
|
||||||
}.toList
|
}.toList
|
||||||
|
|
||||||
branchList.foreach { branch =>
|
branchList.foreach { branch =>
|
||||||
val branchdir = getBranchDir(owner, repository, branch)
|
val branchName = branch.replaceFirst("^refs/heads/", "")
|
||||||
|
val branchdir = getBranchDir(owner, repository, branchName)
|
||||||
if(!branchdir.exists){
|
if(!branchdir.exists){
|
||||||
branchdir.mkdirs()
|
branchdir.mkdirs()
|
||||||
Git.cloneRepository
|
Git.cloneRepository
|
||||||
.setURI(dir.toURL.toString)
|
.setURI(dir.toURL.toString)
|
||||||
|
.setBranch(branch)
|
||||||
.setDirectory(branchdir)
|
.setDirectory(branchdir)
|
||||||
.call
|
.call
|
||||||
Git.open(branchdir).checkout.setName(branch).call
|
Git.open(branchdir).checkout.setName(branchName).call
|
||||||
} else {
|
} else {
|
||||||
Git.open(branchdir).pull.call
|
Git.open(branchdir).pull.call
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user