The Wayback Machine - https://web.archive.org/web/20210815175709/https://github.com/iterative/dvc/issues/5841
Skip to content
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

dvc list: Error on empty directory. #5841

Open
karajan1001 opened this issue Apr 17, 2021 · 1 comment · May be fixed by #6120
Open

dvc list: Error on empty directory. #5841

karajan1001 opened this issue Apr 17, 2021 · 1 comment · May be fixed by #6120

Comments

@karajan1001
Copy link
Collaborator

@karajan1001 karajan1001 commented Apr 17, 2021

Bug Report

Got error message on an empty directory, shouldn't it show nothing? like ls command.

Description

image
Error when list a empty path, strange behavior.
Might relate to

dvc/dvc/repo/ls.py

Lines 40 to 41 in daf0745

if path and not ret:
raise PathMissingError(path, repo, dvc_only=dvc_only)

Reproduce

  1. git init
  2. dvc init
  3. mkdir empty
  4. dvc list . empty

Expected

Show nothing like ls command
image

Environment information

DVC version: 2.0.17+7e4851

Platform: Python 3.8.8 on macOS-10.16-x86_64-i386-64bit
Supports: All remotes
Cache types: https://error.dvc.org/no-dvc-cache
Caches: local
Remotes: None
Workspace directory: apfs on /dev/disk3s1s1
Repo: dvc, git

Output of dvc doctor:

$ dvc doctor

Additional Information (if any):

@karajan1001
Copy link
Collaborator Author

@karajan1001 karajan1001 commented Apr 20, 2021

We have already had a test about this.

dvc/tests/func/test_ls.py

Lines 167 to 173 in 68897aa

def test_ls_repo_with_path_dir_dvc_only_empty(tmp_dir, dvc, scm):
tmp_dir.scm_gen(FS_STRUCTURE, commit="init")
tmp_dir.dvc_gen(DVC_STRUCTURE, commit="dvc")
tmp_dir.scm_gen({"folder/.keep": "content"}, commit="add .keep")
with pytest.raises(PathMissingError):
Repo.ls(os.fspath(tmp_dir), path="folder", dvc_only=True)

and it was introduced from #3246 at the beginning of dvc list command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment