From 80b691c807a6e2b6c98bcaab8198bf8932fcfa4e Mon Sep 17 00:00:00 2001
From: Rhys Arkins <rhys@arkins.net>
Date: Sun, 30 Aug 2020 21:27:02 +0200
Subject: [PATCH] refactor: remove platform.setBaseBranch (#7137)

---
 lib/platform/azure/index.ts                   |  7 ---
 .../__snapshots__/index.spec.ts.snap          | 58 -------------------
 lib/platform/bitbucket-server/index.spec.ts   |  9 ---
 lib/platform/bitbucket-server/index.ts        |  6 --
 .../__snapshots__/index.spec.ts.snap          | 16 -----
 lib/platform/bitbucket/index.spec.ts          |  8 ---
 lib/platform/bitbucket/index.ts               |  5 --
 lib/platform/common.ts                        |  1 -
 lib/platform/gitea/index.spec.ts              | 18 ------
 lib/platform/gitea/index.ts                   |  6 --
 lib/platform/github/index.ts                  |  6 --
 .../gitlab/__snapshots__/index.spec.ts.snap   | 16 -----
 lib/platform/gitlab/index.spec.ts             | 18 ------
 lib/platform/gitlab/index.ts                  |  5 --
 lib/util/git/__snapshots__/index.spec.ts.snap |  4 +-
 lib/util/git/index.spec.ts                    | 13 +++--
 lib/util/git/index.ts                         |  2 +-
 lib/workers/branch/index.ts                   |  3 +-
 lib/workers/repository/init/index.ts          |  5 +-
 .../onboarding/branch/index.spec.ts           |  2 +-
 .../repository/onboarding/branch/index.ts     |  3 +-
 lib/workers/repository/process/index.ts       | 10 ++--
 22 files changed, 22 insertions(+), 199 deletions(-)

diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts
index 12cc87254d..33e8458b53 100644
--- a/lib/platform/azure/index.ts
+++ b/lib/platform/azure/index.ts
@@ -168,13 +168,6 @@ export function getRepoForceRebase(): Promise<boolean> {
   return Promise.resolve(config.repoForceRebase === true);
 }
 
-// istanbul ignore next
-export async function setBaseBranch(branchName: string): Promise<string> {
-  logger.debug(`Setting base branch to ${branchName}`);
-  const baseBranchSha = await git.setBranch(branchName);
-  return baseBranchSha;
-}
-
 export async function getPrList(): Promise<AzurePr[]> {
   logger.debug('getPrList()');
   if (!config.prList) {
diff --git a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
index 014356de7c..48e378bd54 100644
--- a/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/bitbucket-server/__snapshots__/index.spec.ts.snap
@@ -2826,35 +2826,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server/index endpoint with no path setBaseBranch() updates file list 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server/index endpoint with no path setBranchStatus() should be success 1 1`] = `
 Array [
   Object {
@@ -6602,35 +6573,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket-server/index endpoint with path setBaseBranch() updates file list 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo",
-  },
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "stash.renovatebot.com",
-      "user-agent": "https://github.com/renovatebot/renovate",
-      "x-atlassian-token": "no-check",
-    },
-    "method": "GET",
-    "url": "https://stash.renovatebot.com/vcs/rest/api/1.0/projects/SOME/repos/repo/branches/default",
-  },
-]
-`;
-
 exports[`platform/bitbucket-server/index endpoint with path setBranchStatus() should be success 1 1`] = `
 Array [
   Object {
diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts
index 77c8871a2d..b7354b5894 100644
--- a/lib/platform/bitbucket-server/index.spec.ts
+++ b/lib/platform/bitbucket-server/index.spec.ts
@@ -421,15 +421,6 @@ describe(getName(__filename), () => {
         );
       });
 
-      describe('setBaseBranch()', () => {
-        it('updates file list', async () => {
-          expect.assertions(1);
-          await initRepo();
-          await bitbucket.setBaseBranch('branch');
-          expect(httpMock.getTrace()).toMatchSnapshot();
-        });
-      });
-
       describe('addAssignees()', () => {
         it('does not throw', async () => {
           expect(await bitbucket.addAssignees(3, ['some'])).toMatchSnapshot();
diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index a093eb696d..487c56c50f 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -241,12 +241,6 @@ export async function getRepoForceRebase(): Promise<boolean> {
     res.body?.mergeConfig?.defaultStrategy?.id.includes('ff-only')
   );
 }
-
-export async function setBaseBranch(branchName: string): Promise<string> {
-  const baseBranchSha = await git.setBranch(branchName);
-  return baseBranchSha;
-}
-
 // Gets details for a PR
 export async function getPr(
   prNo: number,
diff --git a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
index 278556530f..210688c887 100644
--- a/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/bitbucket/__snapshots__/index.spec.ts.snap
@@ -1090,22 +1090,6 @@ Array [
 ]
 `;
 
-exports[`platform/bitbucket setBaseBranch() updates file list 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "authorization": "Basic YWJjOjEyMw==",
-      "host": "api.bitbucket.org",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://api.bitbucket.org/2.0/repositories/some/repo",
-  },
-]
-`;
-
 exports[`platform/bitbucket setBranchStatus() posts status 1`] = `
 Array [
   Object {
diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts
index 5d529efdfd..b5400c74b7 100644
--- a/lib/platform/bitbucket/index.spec.ts
+++ b/lib/platform/bitbucket/index.spec.ts
@@ -175,14 +175,6 @@ describe('platform/bitbucket', () => {
     });
   });
 
-  describe('setBaseBranch()', () => {
-    it('updates file list', async () => {
-      await initRepoMock();
-      await bitbucket.setBaseBranch('branch');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
-
   describe('getBranchPr()', () => {
     it('bitbucket finds PR for branch', async () => {
       const scope = await initRepoMock();
diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts
index b5c6603f8e..86e1134f18 100644
--- a/lib/platform/bitbucket/index.ts
+++ b/lib/platform/bitbucket/index.ts
@@ -177,11 +177,6 @@ export function getRepoForceRebase(): Promise<boolean> {
   return Promise.resolve(false);
 }
 
-export async function setBaseBranch(branchName: string): Promise<string> {
-  const baseBranchSha = await git.setBranch(branchName);
-  return baseBranchSha;
-}
-
 // istanbul ignore next
 function matchesState(state: string, desiredState: string): boolean {
   if (desiredState === PrState.All) {
diff --git a/lib/platform/common.ts b/lib/platform/common.ts
index 549fe2b1bf..a84f125666 100644
--- a/lib/platform/common.ts
+++ b/lib/platform/common.ts
@@ -169,7 +169,6 @@ export interface Platform {
       | EnsureCommentRemovalConfigByContent
   ): Promise<void>;
   ensureComment(ensureComment: EnsureCommentConfig): Promise<boolean>;
-  setBaseBranch(branchName: string): Promise<string>;
   getPr(number: number): Promise<Pr>;
   findPr(findPRConfig: FindPRConfig): Promise<Pr>;
   refreshPr?(number: number): Promise<void>;
diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts
index 562b86d14a..8e786a34f3 100644
--- a/lib/platform/gitea/index.spec.ts
+++ b/lib/platform/gitea/index.spec.ts
@@ -385,22 +385,6 @@ describe('platform/gitea', () => {
 
       expect(logger.warn).toHaveBeenCalledTimes(1);
     });
-
-    it('should set base branch', async () => {
-      await initFakeRepo();
-      await gitea.setBaseBranch('master');
-
-      expect(gitvcs.setBranch).toHaveBeenCalledTimes(1);
-      expect(gitvcs.setBranch).toHaveBeenCalledWith(mockRepo.default_branch);
-    });
-
-    it('should set custom base branch', async () => {
-      await initFakeRepo();
-      await gitea.setBaseBranch('devel');
-
-      expect(gitvcs.setBranch).toHaveBeenCalledTimes(1);
-      expect(gitvcs.setBranch).toHaveBeenCalledWith('devel');
-    });
   });
 
   describe('getBranchStatus', () => {
@@ -688,7 +672,6 @@ describe('platform/gitea', () => {
       });
 
       await initFakeRepo();
-      await gitea.setBaseBranch('devel');
       const res = await gitea.createPr({
         branchName: mockNewPR.head.label,
         targetBranch: 'devel',
@@ -713,7 +696,6 @@ describe('platform/gitea', () => {
       helper.createPR.mockResolvedValueOnce(mockNewPR);
 
       await initFakeRepo();
-      await gitea.setBaseBranch('devel');
       const res = await gitea.createPr({
         branchName: mockNewPR.head.label,
         targetBranch: 'master',
diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts
index 8ee4628370..56e8eb350d 100644
--- a/lib/platform/gitea/index.ts
+++ b/lib/platform/gitea/index.ts
@@ -414,11 +414,6 @@ const platform: Platform = {
     return BranchStatus.yellow;
   },
 
-  async setBaseBranch(branchName: string): Promise<string> {
-    const baseBranchSha = await git.setBranch(branchName);
-    return baseBranchSha;
-  },
-
   getPrList(): Promise<Pr[]> {
     if (config.prList === null) {
       config.prList = helper
@@ -848,7 +843,6 @@ export const {
   initPlatform,
   initRepo,
   mergePr,
-  setBaseBranch,
   setBranchStatus,
   updatePr,
 } = platform;
diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index 95ebcdbe07..fc4e7e8af4 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -460,12 +460,6 @@ export async function getRepoForceRebase(): Promise<boolean> {
   return config.repoForceRebase;
 }
 
-// istanbul ignore next
-export async function setBaseBranch(branchName: string): Promise<string> {
-  const baseBranchSha = await git.setBranch(branchName);
-  return baseBranchSha;
-}
-
 async function getClosedPrs(): Promise<PrList> {
   if (!config.closedPrList) {
     config.closedPrList = {};
diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
index d496f99df0..52da16cfd5 100644
--- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
+++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap
@@ -1560,22 +1560,6 @@ Array [
 ]
 `;
 
-exports[`platform/gitlab setBaseBranch(branchName) sets the base branch 1`] = `
-Array [
-  Object {
-    "headers": Object {
-      "accept": "application/json",
-      "accept-encoding": "gzip, deflate",
-      "host": "gitlab.com",
-      "private-token": "abc123",
-      "user-agent": "https://github.com/renovatebot/renovate",
-    },
-    "method": "GET",
-    "url": "https://gitlab.com/api/v4/projects/some%2Frepo",
-  },
-]
-`;
-
 exports[`platform/gitlab setBranchStatus sets branch status green 1`] = `
 Array [
   Object {
diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts
index 742dd0b92a..804934013a 100644
--- a/lib/platform/gitlab/index.spec.ts
+++ b/lib/platform/gitlab/index.spec.ts
@@ -329,24 +329,6 @@ describe('platform/gitlab', () => {
       expect(httpMock.getTrace()).toMatchSnapshot();
     });
   });
-  describe('setBaseBranch(branchName)', () => {
-    it('sets the base branch', async () => {
-      httpMock
-        .scope(gitlabApiHost)
-        .get(`/api/v4/projects/some%2Frepo`)
-        .reply(200, {
-          default_branch: 'master',
-          http_url_to_repo: `https://gitlab.com/some/repo.git`,
-        });
-      await gitlab.initRepo({
-        repository: 'some/repo',
-        localDir: '',
-        optimizeForDisabled: false,
-      });
-      await gitlab.setBaseBranch('master');
-      expect(httpMock.getTrace()).toMatchSnapshot();
-    });
-  });
 
   describe('getBranchPr(branchName)', () => {
     it('should return null if no PR exists', async () => {
diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts
index 3d9dddbd0b..16fac4a0a3 100644
--- a/lib/platform/gitlab/index.ts
+++ b/lib/platform/gitlab/index.ts
@@ -248,11 +248,6 @@ export function getRepoForceRebase(): Promise<boolean> {
   return Promise.resolve(config?.mergeMethod !== 'merge');
 }
 
-export async function setBaseBranch(branchName: string): Promise<string> {
-  const baseBranchSha = await git.setBranch(branchName);
-  return baseBranchSha;
-}
-
 type BranchState = 'pending' | 'running' | 'success' | 'failed' | 'canceled';
 
 interface GitlabBranchStatus {
diff --git a/lib/util/git/__snapshots__/index.spec.ts.snap b/lib/util/git/__snapshots__/index.spec.ts.snap
index e6464d6277..fe56ac8e3e 100644
--- a/lib/util/git/__snapshots__/index.spec.ts.snap
+++ b/lib/util/git/__snapshots__/index.spec.ts.snap
@@ -1,5 +1,7 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
+exports[`platform/git checkoutBranch(branchName) should throw if branch does not exist 1`] = `[Error: config-validation]`;
+
 exports[`platform/git getBranchCommit(branchName) should throw if branch does not exist 1`] = `[Error: Cannot fetch commit for branch that does not exist: not_found]`;
 
 exports[`platform/git getBranchFiles(branchName) detects changed files compared to current base branch 1`] = `
@@ -51,5 +53,3 @@ Array [
 exports[`platform/git isBranchModified() should throw if branch does not exist 1`] = `[Error: Cannot check modification for branch that does not exist: not_found]`;
 
 exports[`platform/git isBranchStale() should throw if branch does not exist 1`] = `[Error: Cannot check staleness for branch that does not exist: not_found]`;
-
-exports[`platform/git setBaseBranch(branchName) should throw if branch does not exist 1`] = `[Error: config-validation]`;
diff --git a/lib/util/git/index.spec.ts b/lib/util/git/index.spec.ts
index cea07dcd81..971ec39d8f 100644
--- a/lib/util/git/index.spec.ts
+++ b/lib/util/git/index.spec.ts
@@ -84,17 +84,18 @@ describe('platform/git', () => {
     await base.cleanup();
   });
 
-  describe('setBaseBranch(branchName)', () => {
+  describe('checkoutBranch(branchName)', () => {
     it('sets the base branch as master', async () => {
-      await expect(git.setBranch('master')).resolves.not.toThrow();
+      await expect(git.checkoutBranch('master')).resolves.not.toThrow();
     });
     it('sets non-master base branch', async () => {
-      await expect(git.setBranch('develop')).resolves.not.toThrow();
+      await expect(git.checkoutBranch('develop')).resolves.not.toThrow();
     });
     it('should throw if branch does not exist', async () => {
-      await expect(git.setBranch('not_found')).rejects.toMatchSnapshot();
+      await expect(git.checkoutBranch('not_found')).rejects.toMatchSnapshot();
     });
   });
+
   describe('getFileList()', () => {
     it('should return the correct files', async () => {
       expect(await git.getFileList()).toMatchSnapshot();
@@ -355,7 +356,7 @@ describe('platform/git', () => {
 
       expect(await git.getCommitMessages()).toMatchSnapshot();
 
-      await git.setBranch('develop');
+      await git.checkoutBranch('develop');
 
       git.initRepo({
         localDir: tmpDir.path,
@@ -364,7 +365,7 @@ describe('platform/git', () => {
 
       expect(await git.branchExists('test')).toBeTruthy();
 
-      await git.setBranch('test');
+      await git.checkoutBranch('test');
 
       const msg = await git.getCommitMessages();
       expect(msg).toMatchSnapshot();
diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts
index e04811ef2c..a442df648f 100644
--- a/lib/util/git/index.ts
+++ b/lib/util/git/index.ts
@@ -336,7 +336,7 @@ export async function getCommitMessages(): Promise<string[]> {
   return res.all.map((commit) => commit.message);
 }
 
-export async function setBranch(branchName: string): Promise<CommitSha> {
+export async function checkoutBranch(branchName: string): Promise<CommitSha> {
   await syncGit();
   if (!(await branchExists(branchName))) {
     throwBranchValidationError(branchName);
diff --git a/lib/workers/branch/index.ts b/lib/workers/branch/index.ts
index 12ed5663d8..10e7f3bed8 100644
--- a/lib/workers/branch/index.ts
+++ b/lib/workers/branch/index.ts
@@ -21,6 +21,7 @@ import { emojify } from '../../util/emoji';
 import { exec } from '../../util/exec';
 import { readLocalFile, writeLocalFile } from '../../util/fs';
 import {
+  checkoutBranch,
   deleteBranch,
   getRepoStatus,
   branchExists as gitBranchExists,
@@ -65,7 +66,7 @@ export async function processBranch(
     `processBranch with ${branchConfig.upgrades.length} upgrades`
   );
   logger.trace({ config }, 'branch config');
-  await platform.setBaseBranch(config.baseBranch);
+  await checkoutBranch(config.baseBranch);
   const branchExists = await gitBranchExists(config.branchName);
   const branchPr = await platform.getBranchPr(config.branchName);
   logger.debug(`branchExists=${branchExists}`);
diff --git a/lib/workers/repository/init/index.ts b/lib/workers/repository/init/index.ts
index b8004f92c3..6559682e68 100644
--- a/lib/workers/repository/init/index.ts
+++ b/lib/workers/repository/init/index.ts
@@ -1,8 +1,7 @@
 import { RenovateConfig } from '../../../config';
 import { logger } from '../../../logger';
-import { platform } from '../../../platform';
 import { clone } from '../../../util/clone';
-import { setBranchPrefix } from '../../../util/git';
+import { checkoutBranch, setBranchPrefix } from '../../../util/git';
 import { checkIfConfigured } from '../configured';
 import { checkOnboardingBranch } from '../onboarding/branch';
 import { initApis } from './apis';
@@ -22,7 +21,7 @@ function initializeConfig(config: RenovateConfig): RenovateConfig {
 async function getRepoConfig(config_: RenovateConfig): Promise<RenovateConfig> {
   let config = { ...config_ };
   config.baseBranch = config.defaultBranch;
-  config.baseBranchSha = await platform.setBaseBranch(config.baseBranch);
+  config.baseBranchSha = await checkoutBranch(config.baseBranch);
   config.semanticCommits = await detectSemanticCommits(config);
   config = await checkOnboardingBranch(config);
   config = await mergeRenovateConfig(config);
diff --git a/lib/workers/repository/onboarding/branch/index.spec.ts b/lib/workers/repository/onboarding/branch/index.spec.ts
index 19e5994e53..f4be1d9bfc 100644
--- a/lib/workers/repository/onboarding/branch/index.spec.ts
+++ b/lib/workers/repository/onboarding/branch/index.spec.ts
@@ -98,7 +98,7 @@ describe('workers/repository/onboarding/branch', () => {
       const res = await checkOnboardingBranch(config);
       expect(res.repoIsOnboarded).toBe(false);
       expect(res.branchList).toEqual(['renovate/configure']);
-      expect(platform.setBaseBranch).toHaveBeenCalledTimes(1);
+      expect(git.checkoutBranch).toHaveBeenCalledTimes(1);
       expect(git.commitFiles).toHaveBeenCalledTimes(0);
     });
   });
diff --git a/lib/workers/repository/onboarding/branch/index.ts b/lib/workers/repository/onboarding/branch/index.ts
index 4e51dbd61b..2da046e8d9 100644
--- a/lib/workers/repository/onboarding/branch/index.ts
+++ b/lib/workers/repository/onboarding/branch/index.ts
@@ -5,6 +5,7 @@ import {
 } from '../../../../constants/error-messages';
 import { logger } from '../../../../logger';
 import { platform } from '../../../../platform';
+import { checkoutBranch } from '../../../../util/git';
 import { extractAllDependencies } from '../../extract';
 import { isOnboarded, onboardingPrExists } from './check';
 import { createOnboardingBranch } from './create';
@@ -54,7 +55,7 @@ export async function checkOnboardingBranch(
     }
   }
   if (!config.dryRun) {
-    await platform.setBaseBranch(config.onboardingBranch);
+    await checkoutBranch(config.onboardingBranch);
   }
   const branchList = [config.onboardingBranch];
   return { ...config, repoIsOnboarded, branchList };
diff --git a/lib/workers/repository/process/index.ts b/lib/workers/repository/process/index.ts
index 42f86a80f6..02e8307c5e 100644
--- a/lib/workers/repository/process/index.ts
+++ b/lib/workers/repository/process/index.ts
@@ -2,13 +2,13 @@ import { RenovateConfig, mergeChildConfig } from '../../../config';
 import { logger } from '../../../logger';
 import { PackageFile } from '../../../manager/common';
 import { platform } from '../../../platform';
-import { branchExists } from '../../../util/git';
+import { branchExists, checkoutBranch } from '../../../util/git';
 import { addSplit } from '../../../util/split';
 import { BranchConfig } from '../../common';
 import { ExtractResult, extract, lookup, update } from './extract-update';
 import { WriteUpdateResult } from './write';
 
-async function setBaseBranch(
+async function getBaseBranchConfig(
   baseBranch: string,
   config: RenovateConfig
 ): Promise<RenovateConfig> {
@@ -18,7 +18,7 @@ async function setBaseBranch(
     baseBranchConfig.branchPrefix += `${baseBranch}-`;
     baseBranchConfig.hasBaseBranches = true;
   }
-  baseBranchConfig.baseBranchSha = await platform.setBaseBranch(baseBranch);
+  baseBranchConfig.baseBranchSha = await checkoutBranch(baseBranch);
   return baseBranchConfig;
 }
 
@@ -67,7 +67,7 @@ export async function extractDependencies(
     const extracted: Record<string, Record<string, PackageFile[]>> = {};
     for (const baseBranch of config.baseBranches) {
       if (await branchExists(baseBranch)) {
-        const baseBranchConfig = await setBaseBranch(baseBranch, config);
+        const baseBranchConfig = await getBaseBranchConfig(baseBranch, config);
         extracted[baseBranch] = await extract(baseBranchConfig);
       } else {
         logger.warn({ baseBranch }, 'Base branch does not exist - skipping');
@@ -76,7 +76,7 @@ export async function extractDependencies(
     addSplit('extract');
     for (const baseBranch of config.baseBranches) {
       if (await branchExists(baseBranch)) {
-        const baseBranchConfig = await setBaseBranch(baseBranch, config);
+        const baseBranchConfig = await getBaseBranchConfig(baseBranch, config);
         const packageFiles = extracted[baseBranch];
         const baseBranchRes = await lookup(baseBranchConfig, packageFiles);
         res.branches = res.branches.concat(baseBranchRes?.branches);
-- 
GitLab