From c33da16aba2e3fff357ead02c79343ca614f827a Mon Sep 17 00:00:00 2001 From: Rhys Arkins <rhys@arkins.net> Date: Fri, 9 Oct 2020 08:50:35 +0200 Subject: [PATCH] fix(git): try/catch submodules get --- lib/util/git/index.ts | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/lib/util/git/index.ts b/lib/util/git/index.ts index 78e212a4f8..30d54fe518 100644 --- a/lib/util/git/index.ts +++ b/lib/util/git/index.ts @@ -188,18 +188,23 @@ export async function setBranchPrefix(branchPrefix: string): Promise<void> { } export async function getSubmodules(): Promise<string[]> { - return ( - (await git.raw([ - 'config', - '--file', - '.gitmodules', - '--get-regexp', - 'path', - ])) || '' - ) - .trim() - .split(/[\n\s]/) - .filter((_e: string, i: number) => i % 2); + try { + return ( + (await git.raw([ + 'config', + '--file', + '.gitmodules', + '--get-regexp', + 'path', + ])) || '' + ) + .trim() + .split(/[\n\s]/) + .filter((_e: string, i: number) => i % 2); + } catch (err) /* istanbul ignore next */ { + logger.warn({ err }, 'Error getting submodules'); + return []; + } } export async function syncGit(): Promise<void> { -- GitLab