From f16029d4bbb3906e003500c55089c1e954561b26 Mon Sep 17 00:00:00 2001 From: Samuel Lijin Date: Tue, 27 Jun 2023 16:36:44 -0700 Subject: [PATCH 1/4] fix(lfs): ensure that LFS objects are checked out --- src/git-command-manager.ts | 5 +++++ src/git-source-provider.ts | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/git-command-manager.ts b/src/git-command-manager.ts index 8431658..51e81fe 100644 --- a/src/git-command-manager.ts +++ b/src/git-command-manager.ts @@ -45,6 +45,7 @@ export interface IGitCommandManager { getWorkingDirectory(): string init(objectFormat?: string): Promise isDetached(): Promise + lfsCheckout(): Promise lfsFetch(ref: string): Promise lfsInstall(): Promise log1(format?: string): Promise @@ -383,6 +384,10 @@ class GitCommandManager { return !output.stdout.trim().startsWith('refs/heads/') } + async lfsCheckout(): Promise { + await this.execGit(['lfs', 'checkout']) + } + async lfsFetch(ref: string): Promise { const args = ['lfs', 'fetch', 'origin', ref] diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index b9c1d35..1e312ca 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -271,6 +271,11 @@ export async function getSource(settings: IGitSourceSettings): Promise { await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint) core.endGroup() + // LFS checkout + core.startGroup('Checking out LFS objects') + await git.lfsCheckout() + core.endGroup() + // Submodules if (settings.submodules) { // Temporarily override global config From d98c5beb15e71a8d1546d0315be377c679f414fd Mon Sep 17 00:00:00 2001 From: Sam Lijin Date: Fri, 24 Jul 2026 15:35:44 -0700 Subject: [PATCH 2/4] Apply suggestion from @bdeeming Co-authored-by: BD --- src/git-source-provider.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index 1e312ca..0a39c77 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -272,9 +272,11 @@ export async function getSource(settings: IGitSourceSettings): Promise { core.endGroup() // LFS checkout - core.startGroup('Checking out LFS objects') - await git.lfsCheckout() - core.endGroup() + if (settings.lfs && !settings.sparseCheckout) { + core.startGroup('Checking out LFS objects') + await git.lfsCheckout() + core.endGroup() + } // Submodules if (settings.submodules) { From 6f5159f88ad7d3f4b2285e1cb2d012627773c510 Mon Sep 17 00:00:00 2001 From: Sam Lijin Date: Fri, 24 Jul 2026 17:42:15 -0700 Subject: [PATCH 3/4] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- src/git-source-provider.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/git-source-provider.ts b/src/git-source-provider.ts index 0a39c77..af37f43 100644 --- a/src/git-source-provider.ts +++ b/src/git-source-provider.ts @@ -273,9 +273,9 @@ export async function getSource(settings: IGitSourceSettings): Promise { // LFS checkout if (settings.lfs && !settings.sparseCheckout) { - core.startGroup('Checking out LFS objects') - await git.lfsCheckout() - core.endGroup() + core.startGroup('Checking out LFS objects') + await git.lfsCheckout() + core.endGroup() } // Submodules From 8471d8a73a9c0f90923109fcac1e30d53159576b Mon Sep 17 00:00:00 2001 From: Sam Lijin Date: Fri, 24 Jul 2026 17:45:57 -0700 Subject: [PATCH 4/4] Regenerate dist --- dist/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dist/index.js b/dist/index.js index 06ae5d2..37e10ac 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35816,6 +35816,9 @@ class GitCommandManager { const output = await this.execGit(['rev-parse', '--symbolic-full-name', '--verify', '--quiet', 'HEAD'], true); return !output.stdout.trim().startsWith('refs/heads/'); } + async lfsCheckout() { + await this.execGit(['lfs', 'checkout']); + } async lfsFetch(ref) { const args = ['lfs', 'fetch', 'origin', ref]; const that = this; @@ -41879,6 +41882,12 @@ async function getSource(settings) { startGroup('Checking out the ref'); await git.checkout(checkoutInfo.ref, checkoutInfo.startPoint); endGroup(); + // LFS checkout + if (settings.lfs && !settings.sparseCheckout) { + startGroup('Checking out LFS objects'); + await git.lfsCheckout(); + endGroup(); + } // Submodules if (settings.submodules) { // Temporarily override global config