diff --git a/dist/index.js b/dist/index.js index 766bb5544..455629582 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1267,7 +1267,8 @@ function getSource(settings) { // LFS fetch // Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time). // Explicit lfs fetch will fetch lfs objects in parallel. - if (settings.lfs) { + // For sparse checkouts, let `checkout` fetch the needed objects lazily. + if (settings.lfs && !settings.sparseCheckout) { core.startGroup('Fetching LFS objects'); yield git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref); core.endGroup(); diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index 967097d58..8f9d63f55 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -188,7 +188,8 @@ export async function getSource(settings: IGitSourceSettings): Promise { // LFS fetch // Explicit lfs-fetch to avoid slow checkout (fetches one lfs object at a time). // Explicit lfs fetch will fetch lfs objects in parallel. - if (settings.lfs) { + // For sparse checkouts, let `checkout` fetch the needed objects lazily. + if (settings.lfs && !settings.sparseCheckout) { core.startGroup('Fetching LFS objects') await git.lfsFetch(checkoutInfo.startPoint || checkoutInfo.ref) core.endGroup()