-
Notifications
You must be signed in to change notification settings - Fork 451
Overlay: Only require Git 2.36.0 for repos that contain submodules #3789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,8 +43,9 @@ import { | |
| getGeneratedFiles, | ||
| getGitRoot, | ||
| getGitVersionOrThrow, | ||
| GIT_MINIMUM_VERSION_FOR_OVERLAY, | ||
| GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES, | ||
| GitVersionInfo, | ||
| hasSubmodules, | ||
| isAnalyzingDefaultBranch, | ||
| } from "./git-utils"; | ||
| import { KnownLanguage, Language } from "./languages"; | ||
|
|
@@ -977,21 +978,26 @@ async function validateOverlayDatabaseMode( | |
| ); | ||
| return new Failure(OverlayDisabledReason.NoGitRoot); | ||
| } | ||
| if (gitVersion === undefined) { | ||
| logger.warning( | ||
| `Cannot build an ${overlayDatabaseMode} database because ` + | ||
| "the Git version could not be determined. " + | ||
| "Falling back to creating a normal full database instead.", | ||
| ); | ||
| return new Failure(OverlayDisabledReason.IncompatibleGit); | ||
| } | ||
| if (!gitVersion.isAtLeast(GIT_MINIMUM_VERSION_FOR_OVERLAY)) { | ||
| logger.warning( | ||
| `Cannot build an ${overlayDatabaseMode} database because ` + | ||
| `the installed Git version is older than ${GIT_MINIMUM_VERSION_FOR_OVERLAY}. ` + | ||
| "Falling back to creating a normal full database instead.", | ||
| ); | ||
| return new Failure(OverlayDisabledReason.IncompatibleGit); | ||
| if (await hasSubmodules(sourceRoot)) { | ||
| if (gitVersion === undefined) { | ||
| logger.warning( | ||
| `Cannot build an ${overlayDatabaseMode} database because ` + | ||
| "the repository has submodules and the Git version could not be determined. " + | ||
|
Comment on lines
+981
to
+985
|
||
| "Falling back to creating a normal full database instead.", | ||
| ); | ||
| return new Failure(OverlayDisabledReason.IncompatibleGit); | ||
| } | ||
| if ( | ||
| !gitVersion.isAtLeast(GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES) | ||
| ) { | ||
| logger.warning( | ||
| `Cannot build an ${overlayDatabaseMode} database because ` + | ||
| "the repository has submodules and the installed Git version is older " + | ||
| `than ${GIT_MINIMUM_VERSION_FOR_OVERLAY_WITH_SUBMODULES}. ` + | ||
| "Falling back to creating a normal full database instead.", | ||
| ); | ||
| return new Failure(OverlayDisabledReason.IncompatibleGit); | ||
| } | ||
| } | ||
|
|
||
| return new Success({ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is coverage for the fallback cases when the repo has submodules, but the main new behavior (allow overlay when
gitVersionisundefinedand the repo has no submodules) isn’t currently asserted. Add a test case withgitVersion: undefinedandhasSubmodules: falsethat expects overlay to remain enabled, so this PR’s key behavior doesn’t regress.