Skip to content

Commit 88a7e51

Browse files
committed
Don't disable if we don't need the git version
1 parent 6643a7d commit 88a7e51

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

lib/init-action.js

Lines changed: 13 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/config-utils.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,10 +1948,11 @@ test.serial(
19481948

19491949
test.serial(
19501950
checkOverlayEnablementMacro,
1951-
"Fallback when git version cannot be determined",
1951+
"Fallback when git version cannot be determined and repo has submodules",
19521952
{
19531953
overlayDatabaseEnvVar: "overlay",
19541954
gitVersion: undefined,
1955+
hasSubmodules: true,
19551956
},
19561957
{
19571958
disabledReason: OverlayDisabledReason.IncompatibleGit,

src/config-utils.ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -978,25 +978,26 @@ async function validateOverlayDatabaseMode(
978978
);
979979
return new Failure(OverlayDisabledReason.NoGitRoot);
980980
}
981-
if (gitVersion === undefined) {
982-
logger.warning(
983-
`Cannot build an ${overlayDatabaseMode} database because ` +
984-
"the Git version could not be determined. " +
985-
"Falling back to creating a normal full database instead.",
986-
);
987-
return new Failure(OverlayDisabledReason.IncompatibleGit);
988-
}
989-
if (
990-
(await hasSubmodules(sourceRoot)) &&
991-
!gitVersion.isAtLeast(GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES)
992-
) {
993-
logger.warning(
994-
`Cannot build an ${overlayDatabaseMode} database because ` +
995-
"the repository has submodules and the installed Git version is older " +
996-
`than ${GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES}. ` +
997-
"Falling back to creating a normal full database instead.",
998-
);
999-
return new Failure(OverlayDisabledReason.IncompatibleGit);
981+
if (await hasSubmodules(sourceRoot)) {
982+
if (gitVersion === undefined) {
983+
logger.warning(
984+
`Cannot build an ${overlayDatabaseMode} database because ` +
985+
"the repository has submodules and the Git version could not be determined. " +
986+
"Falling back to creating a normal full database instead.",
987+
);
988+
return new Failure(OverlayDisabledReason.IncompatibleGit);
989+
}
990+
if (
991+
!gitVersion.isAtLeast(GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES)
992+
) {
993+
logger.warning(
994+
`Cannot build an ${overlayDatabaseMode} database because ` +
995+
"the repository has submodules and the installed Git version is older " +
996+
`than ${GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES}. ` +
997+
"Falling back to creating a normal full database instead.",
998+
);
999+
return new Failure(OverlayDisabledReason.IncompatibleGit);
1000+
}
10001001
}
10011002

10021003
return new Success({

0 commit comments

Comments
 (0)