Skip to content

Support git-lfs files in the lib directory #1433

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

Open
robrbecker opened this issue Jul 15, 2016 · 10 comments
Open

Support git-lfs files in the lib directory #1433

robrbecker opened this issue Jul 15, 2016 · 10 comments
Labels
type-enhancement A request for a change that isn't a bug

Comments

@robrbecker
Copy link

robrbecker commented Jul 15, 2016

Problem

The caching that pub does for git refs breaks git-lfs files that are in the lib directory.
(https://git-lfs.github.com/ for reference)
I have a file in the lib directory that is in LFS in repo A.
Repo B has a pubspec dependency on repo A as a git ref.

running pub get causes pub to bare clone the repo into .pub-cache/git/cache/REPO
and then clones from that filesystem location into .pub-cache/git/name-HASH
The 2nd clone can't pull down the file from the LFS server since that repo is now a filesystem based clone and does not know where to find the LFS server.

Solution

Instead of cloning from .pub-cache/git/cache as a filesystem, you could copy the bare repo directory to .pub-cache/git/REPO-hash/.git and modify the config file to set bare = false and then checkout the working directory. This would preserve the actual origin so the LFS file can be found.

I invite comments on this approach or suggestions for alternatives but I'd like to see LFS files work in lib directories in some manner.

@nex3
Copy link
Member

nex3 commented Jul 19, 2016

Can you go into more detail about what exactly is going wrong? Why doesn't the clone preserve the LFS target URL?

I would like to solve this, but I don't think manually copy-pasting the repo is the right way to do so. git is very good at reusing resources when cloning locally, and I don't want to ditch that functionality everywhere to support a small fraction of the use-cases.

@nex3 nex3 added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) needs-info Additional information needed from the issue author labels Jul 19, 2016
@ened
Copy link

ened commented Mar 20, 2019

This issue is still happening, and just popped up for me while I tried to add this component
https://github.com/jadennn/flutter_ijk to a flutter project.

@ened
Copy link

ened commented Apr 3, 2019

@robrbecker Did you find a workaround for this issue (besides creating intermediate repositories)?

@robrbecker
Copy link
Author

@ened Nope. I just avoided the problem by not using git-lfs.

@pbs009
Copy link

pbs009 commented Oct 1, 2021

Is it still not fixed?

I am trying to use git lfs in my flutter project and getting the error as follow:

1m 38s
Run flutter build apk

💪 Building with sound null safety 💪

Running Gradle task 'assembleRelease'...                        

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeReleaseResources'.
> Multiple task action failures occurred:
   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        /home/runner/work/REPO/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

        /home/runner/work/REPO/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: AAPT: error: file failed to compile.

   > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
      > Android resource compilation failed
        /home/runner/work/REPO/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: AAPT: error: failed to read PNG signature: file does not start with PNG signature.

----Same for rest of the images.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 35s
Running Gradle task 'assembleRelease'...                           96.6s
Gradle task assembleRelease failed with exit code 1
Error: Process completed with exit code 1.

I confirmed the types of PNG files using https://stackoverflow.com/a/27670182/5163725.

Not sure what the issue is, any help will be appreciated thanks.

@westito
Copy link

westito commented Jan 17, 2022

I have same issue. I add my LFS repo to dependency_overrides and pub get fails with "smudge error", can't download LFS files. I found that (with --verbose), pub get clones the repository twice:
git clone --mirror repo.git .pub-cache/git/cache/repo
and later
git clone.pub-cache/git/cache/repo .pub-cache/git/repo
Because mirroring does not download LFS files, the second clone will fail. The only solution is call git lfs fetch --all after mirroring, --bare not working neither.

@westito

This comment has been minimized.

@westito

This comment has been minimized.

@sigurdm sigurdm added type-enhancement A request for a change that isn't a bug and removed type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) needs-info Additional information needed from the issue author labels Mar 31, 2022
@CrapsJeroen
Copy link

Are there by any chance any further updates on this? Or is disabling LFS on the original plugin repository still the only "solution" for now?

@makumaaku
Copy link

makumaaku commented Jan 26, 2024

I have same issue.
Any updates?

#2782

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-enhancement A request for a change that isn't a bug
Projects
None yet
8 participants