From 319f301b03d65ed52030683c19f9f0e5e9cabd1a Mon Sep 17 00:00:00 2001 From: takezoe Date: Fri, 12 Apr 2013 03:23:10 +0900 Subject: [PATCH] Fixed updating temporary files for branches. --- src/main/scala/app/RepositoryViewerServlet.scala | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/scala/app/RepositoryViewerServlet.scala b/src/main/scala/app/RepositoryViewerServlet.scala index c7154b519..676975747 100644 --- a/src/main/scala/app/RepositoryViewerServlet.scala +++ b/src/main/scala/app/RepositoryViewerServlet.scala @@ -133,18 +133,20 @@ class RepositoryViewerServlet extends ScalatraServlet with ServletBase { val git = Git.open(dir) val branchList = git.branchList.call.toArray.map { ref => - ref.asInstanceOf[Ref].getName.replaceFirst("^refs/heads/", "") + ref.asInstanceOf[Ref].getName }.toList branchList.foreach { branch => - val branchdir = getBranchDir(owner, repository, branch) + val branchName = branch.replaceFirst("^refs/heads/", "") + val branchdir = getBranchDir(owner, repository, branchName) if(!branchdir.exists){ branchdir.mkdirs() Git.cloneRepository .setURI(dir.toURL.toString) + .setBranch(branch) .setDirectory(branchdir) .call - Git.open(branchdir).checkout.setName(branch).call + Git.open(branchdir).checkout.setName(branchName).call } else { Git.open(branchdir).pull.call }