Skip to content

Commit 948c7fb

Browse files
committed
Test mode: Tolerate missing git binary
1 parent cec3cc5 commit 948c7fb

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/init-action.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import {
5454
getCodeQLMemoryLimit,
5555
getErrorMessage,
5656
isInTestMode,
57+
isBinaryAccessible,
5758
} from "./util";
5859

5960
export * from "./config/db-config";
@@ -936,8 +937,10 @@ export async function initConfig(
936937
await logGitVersionTelemetry(config, gitVersion);
937938
} catch (e) {
938939
logger.warning(`Could not determine Git version: ${getErrorMessage(e)}`);
939-
// Throw the error in test mode so it's more visible.
940-
if (isInTestMode()) {
940+
// Throw the error in test mode so it's more visible, but tolerate cases
941+
// where the git binary is not present, for example because we're running
942+
// in a Docker container.
943+
if (isInTestMode() && (await isBinaryAccessible("git", logger))) {
941944
throw e;
942945
}
943946
}

0 commit comments

Comments
 (0)