mirror of
https://github.com/github/codeql-action.git
synced 2026-04-27 01:08:46 +00:00
Throw in test mode if can't compute git version
This commit is contained in:
Generated
+4
-1
@@ -91565,7 +91565,7 @@ async function getGitVersionOrThrow() {
|
||||
"Failed to get git version."
|
||||
);
|
||||
const match = stdout.match(/^git version ((\d+\.\d+\.\d+).*)$/);
|
||||
if (match?.[1]) {
|
||||
if (match?.[1] && match?.[2]) {
|
||||
return new GitVersionInfo(match[2], match[1]);
|
||||
}
|
||||
throw new Error(`Could not parse Git version from output: ${stdout.trim()}`);
|
||||
@@ -92985,6 +92985,9 @@ async function initConfig(features, inputs) {
|
||||
await logGitVersionTelemetry(config, gitVersion);
|
||||
} catch (e) {
|
||||
logger.warning(`Could not determine Git version: ${getErrorMessage(e)}`);
|
||||
if (isInTestMode()) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
const { overlayDatabaseMode, useOverlayDatabaseCaching } = await getOverlayDatabaseMode(
|
||||
inputs.codeql,
|
||||
|
||||
@@ -53,6 +53,7 @@ import {
|
||||
checkDiskUsage,
|
||||
getCodeQLMemoryLimit,
|
||||
getErrorMessage,
|
||||
isInTestMode,
|
||||
} from "./util";
|
||||
|
||||
export * from "./config/db-config";
|
||||
@@ -935,6 +936,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 e;
|
||||
}
|
||||
}
|
||||
|
||||
// The choice of overlay database mode depends on the selection of languages
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ export async function getGitVersionOrThrow(): Promise<GitVersionInfo> {
|
||||
// Git version output can vary: "git version 2.40.0" or "git version 2.40.0.windows.1"
|
||||
// We capture just the major.minor.patch portion to ensure semver compatibility.
|
||||
const match = stdout.match(/^git version ((\d+\.\d+\.\d+).*)$/);
|
||||
if (match?.[1]) {
|
||||
if (match?.[1] && match?.[2]) {
|
||||
return new GitVersionInfo(match[2], match[1]);
|
||||
}
|
||||
throw new Error(`Could not parse Git version from output: ${stdout.trim()}`);
|
||||
|
||||
Reference in New Issue
Block a user