From 4f570d74128db8726bd33b89e0115849bfe49669 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Wed, 22 Jul 2015 14:56:17 -0700 Subject: Also delete remote refs before pulling, to prevent conflicts Fixes #22, hopefully --- .../scala/com/getbootstrap/savage/server/PullRequestPusher.scala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala b/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala index 030736e..5f07fdf 100644 --- a/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala +++ b/src/main/scala/com/getbootstrap/savage/server/PullRequestPusher.scala @@ -21,6 +21,7 @@ class PullRequestPusher( } def pull(originRepo: RepositoryId): Boolean = { + deleteAllRemoteRefs() // clobberingly fetch all branch heads into a dummy remote SimpleSubprocess(Seq("git", "fetch", "--no-tags", "--recurse-submodules=no", originRepo.asPullRemote, "+refs/heads/*:refs/remotes/scratch/*")).run() match { case SuccessfulExit(_) => { @@ -49,10 +50,13 @@ class PullRequestPusher( false } } - // delete all remote refs + deleteAllRemoteRefs() + success + } + + private def deleteAllRemoteRefs() { implicit val logger = log gitRemoteRefsDirectory.deleteRecursively() - success } private def scheduleFailsafeBranchDeletion(branch: SavageBranch) { -- cgit v1.2.3