From 7021a073aa8f8ed6fadec7f13e52cc082b4bfc93 Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Mon, 5 Mar 2018 12:27:10 +0100
Subject: [PATCH] fix: clean up multiple baseBranches correctly

Re-enables branch cleanup for multiple baseBranches
---
 lib/workers/repository/cleanup.js | 6 +-----
 lib/workers/repository/index.js   | 2 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/workers/repository/cleanup.js b/lib/workers/repository/cleanup.js
index f2fdeabd8a..58ee07637a 100644
--- a/lib/workers/repository/cleanup.js
+++ b/lib/workers/repository/cleanup.js
@@ -3,10 +3,6 @@ module.exports = {
 };
 
 async function pruneStaleBranches(config) {
-  // istanbul ignore if
-  if (config.baseBranches && config.baseBranches.length) {
-    return;
-  }
   // TODO: try/catch
   const { branchList } = config;
   logger.debug('Removing any stale branches');
@@ -46,7 +42,7 @@ async function pruneStaleBranches(config) {
     return;
   }
   for (const branchName of remainingBranches) {
-    logger.debug({ branch: branchName }, `Deleting orphan branch`);
+    logger.info({ branch: branchName }, `Deleting orphan branch`);
     const pr = await platform.findPr(branchName, null, 'open');
     if (pr) {
       logger.info({ prNo: pr.number, prTitle: pr.title }, 'Autoclosing PR');
diff --git a/lib/workers/repository/index.js b/lib/workers/repository/index.js
index a0cba552b6..69e57dab78 100644
--- a/lib/workers/repository/index.js
+++ b/lib/workers/repository/index.js
@@ -50,6 +50,8 @@ async function renovateRepository(repoConfig, token, loop = 1) {
           config.branches = config.branches.concat(res.branches);
         }
       }
+      // istanbul ignore next
+      config.branchList = config.branches.map(branch => branch.branchName);
     } else {
       config = await resolvePackageFiles(config);
       config = await determineUpdates(config);
-- 
GitLab