mirror of
https://github.com/actions/checkout.git
synced 2026-03-19 02:49:07 +00:00
Merge 23441d43ee into 0c366fd6a8
This commit is contained in:
commit
86e25bac74
8
dist/index.js
vendored
8
dist/index.js
vendored
@ -645,7 +645,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.MinimumGitSparseCheckoutVersion = exports.MinimumGitVersion = void 0;
|
exports.MinimumGitSparseIndexVersion = exports.MinimumGitSparseCheckoutVersion = exports.MinimumGitVersion = void 0;
|
||||||
exports.createCommandManager = createCommandManager;
|
exports.createCommandManager = createCommandManager;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
@ -661,6 +661,7 @@ const git_version_1 = __nccwpck_require__(3142);
|
|||||||
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
|
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
|
||||||
exports.MinimumGitVersion = new git_version_1.GitVersion('2.18');
|
exports.MinimumGitVersion = new git_version_1.GitVersion('2.18');
|
||||||
exports.MinimumGitSparseCheckoutVersion = new git_version_1.GitVersion('2.28');
|
exports.MinimumGitSparseCheckoutVersion = new git_version_1.GitVersion('2.28');
|
||||||
|
exports.MinimumGitSparseIndexVersion = new git_version_1.GitVersion('2.32');
|
||||||
function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
|
function createCommandManager(workingDirectory, lfs, doSparseCheckout) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
|
return yield GitCommandManager.createCommandManager(workingDirectory, lfs, doSparseCheckout);
|
||||||
@ -1573,9 +1574,9 @@ function getSource(settings) {
|
|||||||
yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
|
yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
let gitVersion = yield git.version();
|
||||||
// Sparse checkout
|
// Sparse checkout
|
||||||
if (!settings.sparseCheckout) {
|
if (!settings.sparseCheckout) {
|
||||||
let gitVersion = yield git.version();
|
|
||||||
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
||||||
if (gitVersion.checkMinimum(git_command_manager_1.MinimumGitSparseCheckoutVersion)) {
|
if (gitVersion.checkMinimum(git_command_manager_1.MinimumGitSparseCheckoutVersion)) {
|
||||||
yield git.disableSparseCheckout();
|
yield git.disableSparseCheckout();
|
||||||
@ -1589,6 +1590,9 @@ function getSource(settings) {
|
|||||||
else {
|
else {
|
||||||
yield git.sparseCheckoutNonConeMode(settings.sparseCheckout);
|
yield git.sparseCheckoutNonConeMode(settings.sparseCheckout);
|
||||||
}
|
}
|
||||||
|
if (gitVersion.checkMinimum(git_command_manager_1.MinimumGitSparseIndexVersion)) {
|
||||||
|
yield git.config('index.sparse', 'true', false);
|
||||||
|
}
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
}
|
}
|
||||||
// Checkout
|
// Checkout
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import {GitVersion} from './git-version'
|
|||||||
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
|
// sparse-checkout not [well-]supported before 2.28 (see https://github.com/actions/checkout/issues/1386)
|
||||||
export const MinimumGitVersion = new GitVersion('2.18')
|
export const MinimumGitVersion = new GitVersion('2.18')
|
||||||
export const MinimumGitSparseCheckoutVersion = new GitVersion('2.28')
|
export const MinimumGitSparseCheckoutVersion = new GitVersion('2.28')
|
||||||
|
export const MinimumGitSparseIndexVersion = new GitVersion('2.32')
|
||||||
|
|
||||||
export interface IGitCommandManager {
|
export interface IGitCommandManager {
|
||||||
branchDelete(remote: boolean, branch: string): Promise<void>
|
branchDelete(remote: boolean, branch: string): Promise<void>
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import * as stateHelper from './state-helper'
|
|||||||
import * as urlHelper from './url-helper'
|
import * as urlHelper from './url-helper'
|
||||||
import {
|
import {
|
||||||
MinimumGitSparseCheckoutVersion,
|
MinimumGitSparseCheckoutVersion,
|
||||||
|
MinimumGitSparseIndexVersion,
|
||||||
IGitCommandManager
|
IGitCommandManager
|
||||||
} from './git-command-manager'
|
} from './git-command-manager'
|
||||||
import {IGitSourceSettings} from './git-source-settings'
|
import {IGitSourceSettings} from './git-source-settings'
|
||||||
@ -232,9 +233,9 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let gitVersion = await git.version()
|
||||||
// Sparse checkout
|
// Sparse checkout
|
||||||
if (!settings.sparseCheckout) {
|
if (!settings.sparseCheckout) {
|
||||||
let gitVersion = await git.version()
|
|
||||||
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
||||||
if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
|
if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
|
||||||
await git.disableSparseCheckout()
|
await git.disableSparseCheckout()
|
||||||
@ -246,6 +247,10 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||||||
} else {
|
} else {
|
||||||
await git.sparseCheckoutNonConeMode(settings.sparseCheckout)
|
await git.sparseCheckoutNonConeMode(settings.sparseCheckout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gitVersion.checkMinimum(MinimumGitSparseIndexVersion)) {
|
||||||
|
await git.config('index.sparse', 'true', false)
|
||||||
|
}
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user