Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(lfs): ensure that LFS objects are checked out #1392

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/git-command-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface IGitCommandManager {
getWorkingDirectory(): string
init(): Promise<void>
isDetached(): Promise<boolean>
lfsCheckout(): Promise<void>
lfsFetch(ref: string): Promise<void>
lfsInstall(): Promise<void>
log1(format?: string): Promise<string>
Expand Down Expand Up @@ -319,6 +320,10 @@ class GitCommandManager {
return !output.stdout.trim().startsWith('refs/heads/')
}

async lfsCheckout(): Promise<void> {
await this.execGit(['lfs', 'checkout'])
}

async lfsFetch(ref: string): Promise<void> {
const args = ['lfs', 'fetch', 'origin', ref]

Expand Down
5 changes: 5 additions & 0 deletions src/git-source-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ export async function getSource(settings: IGitSourceSettings): Promise<void> {
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
Expand Down