-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[SR-8262] Swift Package Manager fails at checkout when dependent repository contains Git LFS objects #5351
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
Comments
@swift-ci create |
Has there been any update on this issue? There's a similar discussion at https://forums.swift.org/t/swiftpm-with-git-lfs/42396. I am running into this issue as well with https://github.com/foxglove/mcap. This dependency fails during checkout:
A simple |
Is there any progress on it or someone has a solution? |
We're talking about an Xcode specific issue here, correct? I tried reproducing with https://github.com/foxglove/mcap and |
Nope, it's not an Xcode specific issue. Try creating an empty directory and add this Package.swift: // swift-tools-version:5.5
import PackageDescription
let package = Package(
name: "demo",
products: [],
dependencies: [
.package(url: "https://github.com/foxglove/mcap", branch: "main"),
],
targets: []
) Then run
|
Interesting, this does not happen for me. I ended up with the same commit as you, but nothing in
I'm not really familiar with |
Yes, normally users will run It's a very common thing to have installed, since many projects use Git LFS. What do you see when you look at |
Also note that some folks on Discourse have dug deeper into why this happens: https://forums.swift.org/t/swiftpm-with-git-lfs/42396/13 |
Thanks, this helps! |
Thanks for looking into this! 🙌 Just wondering if there’s been any update so far on a possible resolution? |
**Public-Facing Changes** None **Description** Attempted workaround for https://forums.swift.org/t/swiftpm-with-git-lfs/42396/4 / swiftlang/swift-package-manager#5351.
I tried adding a .lfsconfig file to the repo, as recommended in the Discourse thread, and this seems to have worked around the issue for Example project that fails to build in Xcode on my machine: TestPackage.zip |
Based on this thread and the forum discussion, I came to the same blocking errors. Linking git-lfs did work in the sense that Xcode used it but reported a different error downloading various files that were checked in with lfs. The error included "Smudge error: Error downloading..."
Adding a .lfsconfig (with an updated path for my repo) did not help with me when running The only work around I have is to manually clone the repo and include it as a local package—which of course negates all advantages of using a dependency manager. 😫 I did file FB11803523 for Xcode. |
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 However, the .lfsconfig file is causing some other issues for developers working with the repo... 😓 |
Is there any update to this? |
+1 |
1 similar comment
+1 |
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 |
The workaround from @briancordanyoung seem to work, but the Xcode path has changed
|
Are you sure it is SIP @yangkx1024? Wonder why the symlinking was allowed for me, I have not disabled SIP
|
I disabled the SIP and the |
@neonichu if you learned anything about the root cause of this issue or possible workaround, I’m sure many of us would be interested to hear it, thanks :) |
I am using the following workaround:
|
Can we get an update on this please? It's been open for 6 years but seems like a critical barrier preventing 100% adoption of Swift PM. |
@iosdevben I would love to have this fixed. But I would not let it prevent you from adopting SPM. I've been using this work around all this time and the benefits of SPM have made it completely worth it. |
Additional Detail from JIRA
md5: 2218c2c1d09b919e983b204e24d25058
Issue Description:
The error is in the format of: (XXXXX being the name of LFS-tracked file)
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.
The text was updated successfully, but these errors were encountered: