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: