From c86bb5ff2866a69fc1560cdea922baa9d0c8cec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saugat=20Pachhai=20=28=E0=A4=B8=E0=A5=8C=E0=A4=97=E0=A4=BE?= =?UTF-8?q?=E0=A4=A4=29?= Date: Fri, 29 Apr 2022 09:25:47 +0545 Subject: [PATCH] repofs: only use dvcfs when --dvc-only is specified --- dvc/fs/repo.py | 4 ++-- dvc/repo/ls.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/dvc/fs/repo.py b/dvc/fs/repo.py index 10b985c888..a5da9a1fe8 100644 --- a/dvc/fs/repo.py +++ b/dvc/fs/repo.py @@ -312,7 +312,7 @@ def isdvc(self, path, **kwargs): _, _, dvc_fs, dvc_path = self._get_fs_pair(path) return dvc_fs is not None and dvc_fs.isdvc(dvc_path, **kwargs) - def ls(self, path, detail=True, **kwargs): + def ls(self, path, detail=True, dvc_only=False, **kwargs): fs, fs_path, dvc_fs, dvc_path = self._get_fs_pair(path) repo = dvc_fs.repo if dvc_fs else self.repo @@ -325,7 +325,7 @@ def ls(self, path, detail=True, **kwargs): for entry in dvc_fs.ls(dvc_path, detail=False): names.add(dvc_fs.path.name(entry)) - if fs: + if not dvc_only and fs: try: for entry in dvcignore.ls( fs, fs_path, detail=False, ignore_subrepos=ignore_subrepos diff --git a/dvc/repo/ls.py b/dvc/repo/ls.py index bed3f27130..55c41030a0 100644 --- a/dvc/repo/ls.py +++ b/dvc/repo/ls.py @@ -51,7 +51,9 @@ def _ls(fs, path, recursive=None, dvc_only=False): return {} infos = {} - for root, dirs, files in fs.walk(fs_path, dvcfiles=True): + for root, dirs, files in fs.walk( + fs_path, dvcfiles=True, dvc_only=dvc_only + ): entries = chain(files, dirs) if not recursive else files for entry in entries: