Swift package and git-lfs

Hi.
I was wondering if anyone else has the same issue with Swift packages that include binary targets.
Let's say that some static frameworks or resources are stored in git lfs, and they are a part of the Swift Package (binary targets). On the other side, in a project, you would like to add that package (or resolve it) through Xcode. By normal "add swift package flow from the URL," a process fails with "terminated(128)".

I did some digging, and here is what I get:
Code Block Downloading X.a (715 KB)
Error downloading object: X.a (2f7ae21): Smudge error: Error downloading X.a (2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62): error transferring "2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62": [0] remote missing object 2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62
Errors logged to .../checkouts/X/.git/lfs/logs/20210323T161533.36114.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: X.a: smudge filter lfs failed

Interesting part from the git lfs log:
Code Block
error transferring "2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62": [0] remote missing object 2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62
Error downloading x.a (2f7ae213e49b8b079b584b007d2cc0ab0fb0d581a64f8e4f800b1d2807a86f62)

I saw in the custom "checkout" folder where SPM checkouts the package a little bit unusual git structure. I would say that this is the core issue because a normal git clone (with lfs) pulls everything, and files are ok. Git lfs is, of course, already installed and used.

Is there any workaround for this?
No one uses GIT LFS on their local repositories with internal Swift packages? FB9051733
I've run into a similar (same?) issue, but for me it started with Xcode 12.5 RC1 https://developer.apple.com/forums/thread/678635

I'm experiencing the same issue.

I can bypass it with git lfs install --skip-smudge in the host app, but it's not deterministic. Also, even if that works, Xcode will then download the pointer to the lfs file, not the actual file.

This is with Xcode Version 13.2 beta 2 (13C5081f)

True, this should work in the Xcode out-of-the-box.

There's a post about this very issue in the Swift Forums. No resolution, but some further diagnosis.

Swift package and git-lfs
 
 
Q