diff --git a/lib/platform/__snapshots__/index.spec.ts.snap b/lib/platform/__snapshots__/index.spec.ts.snap index b7d428596ea8be..4c5460a19eb90f 100644 --- a/lib/platform/__snapshots__/index.spec.ts.snap +++ b/lib/platform/__snapshots__/index.spec.ts.snap @@ -7,7 +7,6 @@ Array [ "addAssignees", "addReviewers", "branchExists", - "cleanRepo", "commitFiles", "createPr", "deleteBranch", @@ -52,7 +51,6 @@ Array [ "addAssignees", "addReviewers", "branchExists", - "cleanRepo", "commitFiles", "createPr", "deleteBranch", @@ -97,7 +95,6 @@ Array [ "addAssignees", "addReviewers", "branchExists", - "cleanRepo", "commitFiles", "createPr", "deleteBranch", @@ -142,7 +139,6 @@ Array [ "addAssignees", "addReviewers", "branchExists", - "cleanRepo", "commitFiles", "createPr", "deleteBranch", diff --git a/lib/platform/azure/index.spec.ts b/lib/platform/azure/index.spec.ts index 20d9b7d8d4115d..8646b4be1ee515 100644 --- a/lib/platform/azure/index.spec.ts +++ b/lib/platform/azure/index.spec.ts @@ -35,10 +35,6 @@ describe('platform/azure', () => { }); }); - afterEach(async () => { - await azure.cleanRepo(); - }); - // do we need the args? // eslint-disable-next-line @typescript-eslint/no-unused-vars function getRepos(_token: string, _endpoint: string) { @@ -170,12 +166,6 @@ describe('platform/azure', () => { }); }); - describe('cleanRepo()', () => { - it('exists', async () => { - await expect(azure.cleanRepo()).resolves.not.toThrow(); - }); - }); - describe('initRepo', () => { it(`should initialise the config for a repo`, async () => { const config = await initRepo({ diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index acc2608ec3ac42..855fad559d6afe 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -767,9 +767,3 @@ export /* istanbul ignore next */ async function deleteLabel( export function getVulnerabilityAlerts(): Promise { return Promise.resolve([]); } - -export function cleanRepo(): Promise { - git.cleanRepo(); - config = {} as any; - return Promise.resolve(); -} diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index 97415f7103192d..7b5a659695c436 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -197,10 +197,6 @@ describe('platform/bitbucket-server', () => { }); }); - afterEach(async () => { - await bitbucket.cleanRepo(); - }); - describe('initPlatform()', () => { it('should throw if no endpoint', () => { expect.assertions(1); diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index b6df5da0bd2b39..6b389ec2841c23 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -105,13 +105,6 @@ export async function getRepos(): Promise { } } -export function cleanRepo(): Promise { - logger.debug(`cleanRepo()`); - git.cleanRepo(); - config = {} as any; - return Promise.resolve(); -} - // Initialize GitLab by getting base branch export async function initRepo({ repository, diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index cb0946e5841d27..fc81fd40022965 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -74,10 +74,6 @@ describe('platform/bitbucket', () => { setBaseUrl(baseUrl); }); - afterEach(async () => { - await bitbucket.cleanRepo(); - }); - async function initRepoMock( config?: Partial, repoResp?: any diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index f1bc34f24483c5..fd695abe395a24 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -870,14 +870,6 @@ export async function mergePr( return true; } -// Pull Request - -export function cleanRepo(): Promise { - git.cleanRepo(); - config = {} as any; - return Promise.resolve(); -} - export function getVulnerabilityAlerts(): Promise { return Promise.resolve([]); } diff --git a/lib/platform/common.ts b/lib/platform/common.ts index 12382799076239..e05e3f7f93768c 100644 --- a/lib/platform/common.ts +++ b/lib/platform/common.ts @@ -190,7 +190,6 @@ export interface Platform { getCommitMessages(): Promise; setBranchPrefix(branchPrefix: string): Promise; initRepo(config: RepoParams): Promise; - cleanRepo(): Promise; getPrList(): Promise; getPrFiles(pr: Pr): Promise; getAllRenovateBranches(branchPrefix: string): Promise; diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index 10f801e7253ae9..101938707abf5d 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -328,19 +328,6 @@ describe('platform/gitea', () => { }); }); - describe('cleanRepo', () => { - it('does not throw an error with uninitialized repo', async () => { - await gitea.cleanRepo(); - expect(gitvcs.cleanRepo).toHaveBeenCalledTimes(1); - }); - - it('propagates call to storage class with initialized repo', async () => { - await initFakeRepo(); - await gitea.cleanRepo(); - expect(gitvcs.cleanRepo).toHaveBeenCalledTimes(1); - }); - }); - describe('setBranchStatus', () => { const setBranchStatus = async (bsc?: Partial) => { await initFakeRepo(); diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index ca6cca3f807c3a..6a7c9146b67be5 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -362,12 +362,6 @@ const platform: Platform = { } }, - cleanRepo(): Promise { - git.cleanRepo(); - config = {} as any; - return Promise.resolve(); - }, - async setBranchStatus({ branchName, context, @@ -913,7 +907,6 @@ export const { addAssignees, addReviewers, branchExists, - cleanRepo, commitFiles, createPr, deleteBranch, diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 773291d2935439..04bdd79ad3d2df 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -149,13 +149,6 @@ export async function getRepos(): Promise { } } -export function cleanRepo(): Promise { - git.cleanRepo(); - // In theory most of this isn't necessary. In practice.. - config = {} as any; - return Promise.resolve(); -} - async function getBranchProtection( branchName: string ): Promise { @@ -208,7 +201,7 @@ export async function initRepo({ }: RepoParams): Promise { logger.debug(`initRepo("${repository}")`); // config is used by the platform api itself, not necessary for the app layer to know - await cleanRepo(); + config = { localDir, repository } as any; // istanbul ignore if if (endpoint) { // Necessary for Renovate Pro - do not remove @@ -222,8 +215,6 @@ export async function initRepo({ }); config.isGhe = URL.parse(defaults.endpoint).host !== 'api.github.com'; config.renovateUsername = renovateUsername; - config.localDir = localDir; - config.repository = repository; [config.repositoryOwner, config.repositoryName] = repository.split('/'); let res; try { diff --git a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap index 5945db02f79e7b..cc5febdaceae55 100644 --- a/lib/platform/gitlab/__snapshots__/index.spec.ts.snap +++ b/lib/platform/gitlab/__snapshots__/index.spec.ts.snap @@ -175,8 +175,6 @@ Array [ ] `; -exports[`platform/gitlab cleanRepo() exists 1`] = `undefined`; - exports[`platform/gitlab commitFiles() sends to gitFs 1`] = ` Array [ Object { diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index edab97df8ea009..b109d5f89525e2 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -45,10 +45,6 @@ describe('platform/gitlab', () => { httpMock.setup(); }); - afterEach(async () => { - await gitlab.cleanRepo(); - }); - describe('initPlatform()', () => { it(`should throw if no token`, async () => { await expect(gitlab.initPlatform({} as any)).rejects.toThrow(); @@ -165,11 +161,6 @@ describe('platform/gitlab', () => { expect(httpMock.getTrace()).toMatchSnapshot(); }); }); - describe('cleanRepo()', () => { - it('exists', async () => { - expect(await gitlab.cleanRepo()).toMatchSnapshot(); - }); - }); describe('initRepo', () => { it(`should throw error if disabled in renovate.json`, async () => { diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index d91a6eb0e7178f..93437ee303678d 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -138,13 +138,6 @@ function urlEscape(str: string): string { return str ? str.replace(/\//g, '%2F') : str; } -export function cleanRepo(): Promise { - git.cleanRepo(); - // In theory most of this isn't necessary. In practice.. - config = {} as any; - return Promise.resolve(); -} - // Initialize GitLab by getting base branch export async function initRepo({ repository, diff --git a/lib/util/git/index.spec.ts b/lib/util/git/index.spec.ts index 156ac77652e344..de0a8e374265ac 100644 --- a/lib/util/git/index.spec.ts +++ b/lib/util/git/index.spec.ts @@ -60,7 +60,6 @@ describe('platform/git', () => { afterEach(async () => { await tmpDir.cleanup(); await origin.cleanup(); - git.cleanRepo(); }); afterAll(async () => { diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts index 17e12ede606c4f..92686a7884c68c 100644 --- a/lib/util/git/index.ts +++ b/lib/util/git/index.ts @@ -146,19 +146,7 @@ export async function getSubmodules(): Promise { .filter((_e: string, i: number) => i % 2); } -export function isInitialized(): boolean { - return !!git; -} - -export function cleanRepo(): void { - if (isInitialized()) { - // no-op - } -} - export async function initRepo(args: StorageConfig): Promise { - cleanRepo(); - config = { ...args } as any; config.branchExists = {}; diff --git a/lib/workers/repository/index.ts b/lib/workers/repository/index.ts index 64269ebc6a6c42..e3fa6e65598efd 100644 --- a/lib/workers/repository/index.ts +++ b/lib/workers/repository/index.ts @@ -1,7 +1,6 @@ import fs from 'fs-extra'; import { RenovateConfig } from '../../config'; import { logger, setMeta } from '../../logger'; -import { platform } from '../../platform'; import { deleteLocalFile } from '../../util/fs'; import { addSplit, getSplits, splitInit } from '../../util/split'; import handleError from './error'; @@ -51,7 +50,6 @@ export async function renovateRepository( const errorRes = await handleError(config, err); repoResult = processResult(config, errorRes); } - await platform.cleanRepo(); if (config.localDir && !config.persistRepoData) { await deleteLocalFile('.'); }