diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 36d3f5160..95010644c 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -162179,12 +162179,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 8ff502a83..4eb98297f 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -107774,12 +107774,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 1980bf1f3..afe87e5e0 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -104233,12 +104233,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 49956d89f..c9b29cf6e 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -165691,12 +165691,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/init-action.js b/lib/init-action.js index efd78a136..2ad473a21 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -105317,12 +105317,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 8d3ba7856..b7556ff41 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -104226,12 +104226,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 8c2dbdbd2..d1999c218 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -104092,12 +104092,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/upload-lib.js b/lib/upload-lib.js index 3a41bf1f6..ef828d90d 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -107382,12 +107382,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 6c97bdc38..e2e44d83d 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -107067,12 +107067,8 @@ function hasSubmodules(gitRoot) { } var getFileOidsUnderPath = async function(basePath) { const gitRoot = await getGitRoot(basePath); - if (gitRoot === void 0) { - throw new Error( - `Cannot determine the Git root from ${basePath}.` - ); - } - const args = hasSubmodules(gitRoot) ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; + const mayHaveSubmodules = gitRoot === void 0 ? true : hasSubmodules(gitRoot); + const args = mayHaveSubmodules ? ["ls-files", "--recurse-submodules", "--stage"] : ["ls-files", "--stage"]; const stdout = await runGitCommand( basePath, args, diff --git a/src/config-utils.test.ts b/src/config-utils.test.ts index 4a3b761e8..154963fa0 100644 --- a/src/config-utils.test.ts +++ b/src/config-utils.test.ts @@ -1959,6 +1959,20 @@ test.serial( }, ); +test.serial( + checkOverlayEnablementMacro, + "Overlay enabled when git version cannot be determined and repo has no submodules", + { + overlayDatabaseEnvVar: "overlay", + gitVersion: undefined, + hasSubmodules: false, + }, + { + overlayDatabaseMode: OverlayDatabaseMode.Overlay, + useOverlayDatabaseCaching: false, + }, +); + test.serial( checkOverlayEnablementMacro, "No overlay when disabled via repository property",