| 265 | |
| 266 | |
| 267 | def lfs_prefetch(fs: "FileSystem", paths: list[str]): |
| 268 | from scmrepo.git.lfs import fetch as _lfs_fetch |
| 269 | |
| 270 | from dvc.fs.dvc import DVCFileSystem |
| 271 | from dvc.fs.git import GitFileSystem |
| 272 | |
| 273 | if isinstance(fs, DVCFileSystem) and isinstance(fs.repo.fs, GitFileSystem): |
| 274 | git_fs = fs.repo.fs |
| 275 | scm = fs.repo.scm |
| 276 | assert isinstance(scm, Git) |
| 277 | else: |
| 278 | return |
| 279 | |
| 280 | try: |
| 281 | if "filter=lfs" not in git_fs.open(".gitattributes").read(): |
| 282 | return |
| 283 | except OSError: |
| 284 | return |
| 285 | with TqdmGit(desc="Checking for Git-LFS objects") as pbar: |
| 286 | _lfs_fetch( |
| 287 | scm, |
| 288 | [git_fs.rev], |
| 289 | include=[(path if path.startswith("/") else f"/{path}") for path in paths], |
| 290 | progress=pbar.update_git, |
| 291 | ) |
| 292 | |
| 293 | |
| 294 | def add_no_submodules( |