mirror of
https://code.forgejo.org/actions/checkout.git
synced 2026-08-27 20:44:58 -04:00
Materialize LFS objects with an explicit git lfs checkout
Problem On persistent/self-hosted runners that reuse a working directory across jobs, LFS-tracked files can be left as pointer files instead of real content when a lfs: false checkout precedes a lfs: true checkout of the same repo. Sequence that triggers it: 1. A lfs: false run sets GIT_LFS_SKIP_SMUDGE=1, so git checkout writes LFS files to the working tree as pointers. 2. A later lfs: true run on the same worktree fetches the objects into .git/lfs, but git checkout sees the tree already at the target commit and does not re-smudge the already-present pointer files. Result: the objects are in the local cache, but the working tree still contains pointers. The action relies on the smudge filter firing during git checkout to materialize content — which holds on a clean tree (GitHub-hosted runners) but not on a reused one. Related: actions/checkout#270
This commit is contained in:
parent
f548e57e54
commit
579920382a
7 changed files with 36 additions and 0 deletions
|
|
@ -1065,6 +1065,7 @@ async function setup(testName: string): Promise<void> {
|
|||
getWorkingDirectory: jest.fn(() => workspace),
|
||||
init: jest.fn(),
|
||||
isDetached: jest.fn(),
|
||||
lfsCheckout: jest.fn(),
|
||||
lfsFetch: jest.fn(),
|
||||
lfsInstall: jest.fn(),
|
||||
log1: jest.fn(),
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@ async function setup(testName: string): Promise<void> {
|
|||
getWorkingDirectory: jest.fn(() => repositoryPath),
|
||||
init: jest.fn(),
|
||||
isDetached: jest.fn(),
|
||||
lfsCheckout: jest.fn(),
|
||||
lfsFetch: jest.fn(),
|
||||
lfsInstall: jest.fn(),
|
||||
log1: jest.fn(),
|
||||
|
|
|
|||
|
|
@ -9,3 +9,8 @@ if [ ! -f "./lfs/lfs-file.bin" ]; then
|
|||
echo "Expected lfs file does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if head -n 1 "./lfs/lfs-file.bin" | grep -q "git-lfs.github.com/spec"; then
|
||||
echo "Expected lfs file to be materialized, but it is still an LFS pointer"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue