mirror of
https://github.com/actions/checkout.git
synced 2026-03-19 18:40:23 +08:00
Enable sparse index to fix Git LFS performance with sparse checkouts
This commit is contained in:
parent
0c366fd6a8
commit
23441d43ee
3 changed files with 13 additions and 3 deletions
|
|
@ -11,6 +11,7 @@ import * as stateHelper from './state-helper'
|
|||
import * as urlHelper from './url-helper'
|
||||
import {
|
||||
MinimumGitSparseCheckoutVersion,
|
||||
MinimumGitSparseIndexVersion,
|
||||
IGitCommandManager
|
||||
} from './git-command-manager'
|
||||
import {IGitSourceSettings} from './git-source-settings'
|
||||
|
|
@ -232,9 +233,9 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
core.endGroup()
|
||||
}
|
||||
|
||||
let gitVersion = await git.version()
|
||||
// Sparse checkout
|
||||
if (!settings.sparseCheckout) {
|
||||
let gitVersion = await git.version()
|
||||
// no need to disable sparse-checkout if the installed git runtime doesn't even support it.
|
||||
if (gitVersion.checkMinimum(MinimumGitSparseCheckoutVersion)) {
|
||||
await git.disableSparseCheckout()
|
||||
|
|
@ -246,6 +247,10 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
|
|||
} else {
|
||||
await git.sparseCheckoutNonConeMode(settings.sparseCheckout)
|
||||
}
|
||||
|
||||
if (gitVersion.checkMinimum(MinimumGitSparseIndexVersion)) {
|
||||
await git.config('index.sparse', 'true', false)
|
||||
}
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue