From bffd90de6684eae8753ca234cb207139e4bd21f9 Mon Sep 17 00:00:00 2001 From: Jamie Magee <JamieMagee@users.noreply.github.com> Date: Sun, 29 Nov 2020 20:41:53 +0100 Subject: [PATCH] fix(git): propagate cloneSubmodules (#7844) --- lib/platform/azure/index.ts | 2 ++ lib/platform/bitbucket-server/index.ts | 2 ++ lib/platform/bitbucket/index.ts | 2 ++ lib/platform/common.ts | 1 + lib/platform/gitea/index.ts | 8 +++++++- lib/platform/github/index.ts | 3 ++- lib/platform/gitlab/index.ts | 3 +++ 7 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index 49f60983b2..38091b6904 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -118,6 +118,7 @@ export async function getJsonFile(fileName: string): Promise<any | null> { export async function initRepo({ repository, localDir, + cloneSubmodules, }: RepoParams): Promise<RepoResult> { logger.debug(`initRepo("${repository}")`); config = { repository } as Config; @@ -161,6 +162,7 @@ export async function initRepo({ extraCloneOpts: azureHelper.getStorageExtraCloneOpts(opts), gitAuthorName: global.gitAuthor?.name, gitAuthorEmail: global.gitAuthor?.email, + cloneSubmodules, }); const repoConfig: RepoResult = { defaultBranch, diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 6026382521..23a2d6cf38 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -132,6 +132,7 @@ export async function getJsonFile(fileName: string): Promise<any | null> { export async function initRepo({ repository, localDir, + cloneSubmodules, }: RepoParams): Promise<RepoResult> { logger.debug( `initRepo("${JSON.stringify({ repository, localDir }, null, 2)}")` @@ -167,6 +168,7 @@ export async function initRepo({ url: gitUrl, gitAuthorName: global.gitAuthor?.name, gitAuthorEmail: global.gitAuthor?.email, + cloneSubmodules, }); try { diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index 651454a3d2..7b6d8656c5 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -116,6 +116,7 @@ export async function getJsonFile(fileName: string): Promise<any | null> { export async function initRepo({ repository, localDir, + cloneSubmodules, }: RepoParams): Promise<RepoResult> { logger.debug(`initRepo("${repository}")`); const opts = hostRules.find({ @@ -172,6 +173,7 @@ export async function initRepo({ url, gitAuthorName: global.gitAuthor?.name, gitAuthorEmail: global.gitAuthor?.email, + cloneSubmodules, }); const repoConfig: RepoResult = { defaultBranch: info.mainbranch, diff --git a/lib/platform/common.ts b/lib/platform/common.ts index 782514eb39..56e23c77e3 100644 --- a/lib/platform/common.ts +++ b/lib/platform/common.ts @@ -40,6 +40,7 @@ export interface RepoParams { forkToken?: string; includeForks?: boolean; renovateUsername?: string; + cloneSubmodules?: boolean; } /** diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index a3bca1b7f8..9205e65217 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -45,6 +45,7 @@ interface GiteaRepoConfig { issueList: Promise<Issue[]> | null; labelList: Promise<helper.Label[]> | null; defaultBranch: string; + cloneSubmodules: boolean; } const defaults = { @@ -217,12 +218,17 @@ const platform: Platform = { } }, - async initRepo({ repository, localDir }: RepoParams): Promise<RepoResult> { + async initRepo({ + repository, + localDir, + cloneSubmodules, + }: RepoParams): Promise<RepoResult> { let repo: helper.Repo; config = {} as any; config.repository = repository; config.localDir = localDir; + config.cloneSubmodules = cloneSubmodules; // Attempt to fetch information about repository try { diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index db12e20db1..6ea1da157f 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -168,10 +168,11 @@ export async function initRepo({ forkToken, localDir, renovateUsername, + cloneSubmodules, }: RepoParams): Promise<RepoResult> { logger.debug(`initRepo("${repository}")`); // config is used by the platform api itself, not necessary for the app layer to know - config = { localDir, repository } as any; + config = { localDir, repository, cloneSubmodules } as any; // istanbul ignore if if (endpoint) { // Necessary for Renovate Pro - do not remove diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index 591fa619b9..fa540e7864 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -51,6 +51,7 @@ let config: { issueList: GitlabIssue[]; mergeMethod: MergeMethod; defaultBranch: string; + cloneSubmodules: boolean; } = {} as any; const defaults = { @@ -153,10 +154,12 @@ export async function getJsonFile(fileName: string): Promise<any | null> { export async function initRepo({ repository, localDir, + cloneSubmodules, }: RepoParams): Promise<RepoResult> { config = {} as any; config.repository = urlEscape(repository); config.localDir = localDir; + config.cloneSubmodules = cloneSubmodules; let res: HttpResponse<RepoResponse>; try { -- GitLab