swift-package-manager: [SR-8262] Swift Package Manager fails at checkout when dependent repository contains Git LFS objects
Previous ID | SR-8262 |
Radar | rdar://problem/42246102 |
Original Reporter | yifei (JIRA User) |
Type | Bug |
Additional Detail from JIRA
Votes | 2 |
Component/s | Package Manager |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 2218c2c1d09b919e983b204e24d25058
Issue Description:
The error is in the format of: (XXXXX being the name of LFS-tracked file)
Error downloading object: XXXXX (hash): Smudge error: Error downloading XXXXX (hash): batch request: missing protocol: "/path/to/project/.build/repositories/dependency.git/info/lfs"
error: external filter 'git-lfs filter-process' failed
fatal: XXXXX: smudge filter lfs failed
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'
This happens during the “cloneCheckout” phase i.e. invoking “git clone --shared”. If I disable the LFS filter by editing the global .gitconfig, the project builds fine.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 7
- Comments: 23 (4 by maintainers)
Commits related to this issue
- Add .lfsconfig to work around SwiftPM bug (#685) **Public-Facing Changes** None **Description** Attempted workaround for https://forums.swift.org/t/swiftpm-with-git-lfs/42396/4 / https://github.... — committed to foxglove/mcap by jtbandes 2 years ago
- Uninstall LFS as it is not supported by SPM see https://github.com/apple/swift-package-manager/issues/5351 — committed to ruuvi/BTKit by rinat-enikeev 5 months ago
- Uninstall LFS as it is not supported by SPM (#14) see https://github.com/apple/swift-package-manager/issues/5351 — committed to ruuvi/BTKit by rinat-enikeev 5 months ago
Is there any update to this?
The workaround from @briancordanyoung seem to work, but the Xcode path has changed
One option for this I wrote up here (which only applies if the LFS files are something optional for your package, like test results): https://stackoverflow.com/questions/67457594/swift-package-manager-does-not-work-with-git-lfs/77336212#77336212
+1
Not sure if it helps you, but I believe the .lfsconfig file has to be present on the repo’s default branch. When SPM clones the package it starts with the default branch and then checks out whichever branch/commit you requested.
This did ultimately end up working well enough for me, I was able to use
xcodebuild
in CI (but not the Xcode app): https://github.com/foxglove/MCAPSpotlightImporter/actions/runs/3380647041/jobs/5613664270However, the .lfsconfig file is causing some other issues for developers working with the repo… 😓
Thanks, this helps!