Test mode: Tolerate missing git binary

This commit is contained in:
Henry Mercer
2025-12-18 13:01:00 +00:00
parent cec3cc5782
commit 948c7fbf11
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -54,6 +54,7 @@ import {
getCodeQLMemoryLimit,
getErrorMessage,
isInTestMode,
isBinaryAccessible,
} from "./util";
export * from "./config/db-config";
@@ -936,8 +937,10 @@ export async function initConfig(
await logGitVersionTelemetry(config, gitVersion);
} catch (e) {
logger.warning(`Could not determine Git version: ${getErrorMessage(e)}`);
// Throw the error in test mode so it's more visible.
if (isInTestMode()) {
// Throw the error in test mode so it's more visible, but tolerate cases
// where the git binary is not present, for example because we're running
// in a Docker container.
if (isInTestMode() && (await isBinaryAccessible("git", logger))) {
throw e;
}
}