You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check git version before attempting to disable sparse-checkout (#1656)
* Check git version before attempting to disable `sparse-checkout`
* Bump `MinimumGitSparseCheckoutVersion` to 2.28 due to #1386
* Initial prep for release 4.1.3
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
483
484
exports.MinimumGitVersion = new git_version_1.GitVersion('2.18');
485
+
exports.MinimumGitSparseCheckoutVersion = new git_version_1.GitVersion('2.28');
484
486
function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
gitVersion = new git_version_1.GitVersion(match[0]);
918
+
this.gitVersion = new git_version_1.GitVersion(match[0]);
911
919
}
912
920
}
913
-
if (!gitVersion.isValid()) {
921
+
if (!this.gitVersion.isValid()) {
914
922
throw new Error('Unable to determine git version');
915
923
}
916
924
// Minimum git version
917
-
if (!gitVersion.checkMinimum(exports.MinimumGitVersion)) {
918
-
throw new Error(`Minimum required git version is ${exports.MinimumGitVersion}. Your git ('${this.gitPath}') is ${gitVersion}`);
925
+
if (!this.gitVersion.checkMinimum(exports.MinimumGitVersion)) {
926
+
throw new Error(`Minimum required git version is ${exports.MinimumGitVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
919
927
}
920
928
if (this.lfs) {
921
929
// Git-lfs version
@@ -943,14 +951,12 @@ class GitCommandManager {
943
951
}
944
952
this.doSparseCheckout = doSparseCheckout;
945
953
if (this.doSparseCheckout) {
946
-
// The `git sparse-checkout` command was introduced in Git v2.25.0
947
-
const minimumGitSparseCheckoutVersion = new git_version_1.GitVersion('2.25');
948
-
if (!gitVersion.checkMinimum(minimumGitSparseCheckoutVersion)) {
949
-
throw new Error(`Minimum Git version required for sparse checkout is ${minimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${gitVersion}`);
954
+
if (!this.gitVersion.checkMinimum(exports.MinimumGitSparseCheckoutVersion)) {
955
+
throw new Error(`Minimum Git version required for sparse checkout is ${exports.MinimumGitSparseCheckoutVersion}. Your git ('${this.gitPath}') is ${this.gitVersion}`);
Copy file name to clipboardExpand all lines: src/git-command-manager.ts
+16-10Lines changed: 16 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,9 @@ import {GitVersion} from './git-version'
11
11
12
12
// Auth header not supported before 2.9
13
13
// Wire protocol v2 not supported before 2.18
14
+
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
0 commit comments