diff --git a/lib/src/source/git.dart b/lib/src/source/git.dart index 0d98ae935..192aa967a 100644 --- a/lib/src/source/git.dart +++ b/lib/src/source/git.dart @@ -489,6 +489,7 @@ class BoundGitSource extends CachedSource { assert(!_updatedRepos.contains(path)); try { await _clone(ref.description['url'], path, mirror: true); + await _fetchLfs(path); } catch (_) { await _deleteGitRepoIfInvalid(path); rethrow; @@ -612,6 +613,15 @@ class BoundGitSource extends CachedSource { .run(['checkout', ref], workingDir: repoPath).then((result) => null); } + /// Fetch all LFS objects in [repoPath]. + Future _fetchLfs(String repoPath) async { + try { + await git.run(['lfs', 'fetch', '--all'], workingDir: repoPath); + } catch (_) { + /// Skip, maybe LFS not installed + } + } + String _revisionCachePath(PackageId id) => p.join( systemCacheRoot, "${_repoName(id)}-${id.description['resolved-ref']}");