Skip to content

Commit

Permalink
fix(git): defensive fileList check
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed May 15, 2021
1 parent 82fc920 commit a2a6ac9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/util/git/index.ts
Expand Up @@ -433,7 +433,19 @@ export async function getFileList(): Promise<string[]> {
await syncGit();
const branch = config.currentBranch;
const submodules = await getSubmodules();
const files: string = await git.raw(['ls-tree', '-r', branch]);
let files: string;
try {
files = await git.raw(['ls-tree', '-r', branch]);
} catch (err) /* istanbul ignore next */ {
if (err.message?.includes('fatal: Not a valid object name')) {
logger.debug(
{ err },
'Branch not found when checking branch list - aborting'
);
throw new Error(REPOSITORY_CHANGED);
}
throw err;
}
// istanbul ignore if
if (!files) {
return [];
Expand Down

0 comments on commit a2a6ac9

Please sign in to comment.