Dvc: `dvc list`: handle local repos differently?

Created on 4 Apr 2020  路  9Comments  路  Source: iterative/dvc

When I run the command dvc list . from any sub-directory of the project I get the following error:

ERROR: failed to list '.' - Failed to clone repo '.' to '/tmp/tmp2qmfnem7dvc-clone': Cmd('git') failed due to: exit code(128)
  cmdline: git clone --no-single-branch -v . /tmp/tmp2qmfnem7dvc-clone
  stderr: 'fatal: repository '.' does not exist
'

Though it works when executed from the root directory of the project

DVC: 0.91.1 (arch linux;pip)


UPDATED (@shcheklein):

repurposed it a bit - https://github.com/iterative/dvc/issues/3590#issuecomment-612558038

feature request help wanted p3-nice-to-have research

Most helpful comment

To be honest I think it makes sense to handle this as a special case:

  • don't clone
  • if URL is a local path that is part of the DVC repo - show the result of dvc list <path-to-Git-root> URL. It means if I run dvc list . I just see the files in the current location - it is probably the most expected result.

@iterative/engineering @casperdcl thoughts?

(reopening, since it's annoying to remember the special syntax when I deal with the local repo, and other users were caught by surprise)

All 9 comments

Hi @ahmed-shariff !

dvc list expects to receive a URL to a git repo, which . isn't when you are not in the git repo root. Same as you can't git clone that directory. Theoretically, we could check if URL that you pass is a git repo subdir, but I'm not sure if it is worth the effort and it also will probably lead to misuse, where people would try to use it as ls in their subdirs.

I see. Thank you for the clarification.

To be honest I think it makes sense to handle this as a special case:

  • don't clone
  • if URL is a local path that is part of the DVC repo - show the result of dvc list <path-to-Git-root> URL. It means if I run dvc list . I just see the files in the current location - it is probably the most expected result.

@iterative/engineering @casperdcl thoughts?

(reopening, since it's annoying to remember the special syntax when I deal with the local repo, and other users were caught by surprise)

@shcheklein I agree

I'm using a local remote and I receive the same error when running dvc list <path-to-local-remote>. Is this expected behaviour?

For reference the "local remote" is actually a mounted network drive.

ERROR: failed to list '/mnt/dr_dvc/vision/dataset_registry' - Failed to clone repo '/mnt/dr_dvc/vision/dataset_registry' to '/tmp/tmp9bkq340cdvc-clone': Cmd('git') failed due to: exit code(128)
  cmdline: git clone --no-single-branch -v /mnt/dr_dvc/vision/dataset_registry /tmp/tmp9bkq340cdvc-clone
  stderr: 'fatal: repository '/mnt/dr_dvc/vision/dataset_registry' does not exist

Hi @jamessergeant, dvc list expects the path or URL to the DVC repository itself, not to a remote storage location. In fact I believe it doesn't check remotes at all to produce the list. Whether the data exists in remote storage is not guaranteed by dvc list. You have to attempt dvc get or dvc import to find out.

p.s. guys I'm updating the dvc list cmd ref in iterative/dvc.org/pull/1174

Not sure if this belongs on this issue as well, but this also applies when running dvc list inside of a dvc repo that was created with dvc init --subdir.

@andrewcstewart Not directly. dvc list support for subrepos will be implemented as a part of https://github.com/iterative/dvc/issues/3369

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shcheklein picture shcheklein  路  3Comments

mdscruggs picture mdscruggs  路  3Comments

shcheklein picture shcheklein  路  3Comments

siddygups picture siddygups  路  3Comments

tc-ying picture tc-ying  路  3Comments