Dvc: version: fails when .git/ dir is removed from DVC repo

Created on 9 Mar 2020  路  5Comments  路  Source: iterative/dvc

DVC 0.87.0

$ dvc version
ERROR: unexpected error - /... is not a git repository

Having any troubles? Hit us up at https://dvc.org/support, we are always happy to help!

Maybe let's also check also other independent commands like dvc list and dvc get.

bug p2-medium

All 5 comments

@jorgeorpinel, I'm unable to reproduce this on a temporary directory. Can you provide more information?

P.S. I was able to reproduce when I deleted .git folder inside a dvc init repo and then run dvc version.

git init && dvc init
rm -rf .git
dvc version

But, that's a different issue.

Good catch @skshetry, I think that's what was happening, but I didn't realize until now.

So is it a bug? Or expected behavior? Maybe the specific case can be handled with a better message at least? Changed the title and labels here, but feel free to close.

@jorgeorpinel It is a bug, indeed.

Reopening, looks like it's broken again:

$ dvc init --no-scm
$ dvc config core.no_scm False
$ dvc version -v
2020-06-18 22:39:10,654 ERROR: unexpected error - expected str, bytes or os.PathLike object, not NoneType
------------------------------------------------------------
Traceback (most recent call last):
  File "/home/saugat/repos/iterative/dvc/dvc/main.py", line 53, in main
    ret = cmd.run()
  File "/home/saugat/repos/iterative/dvc/dvc/command/version.py", line 40, in run
    repo = Repo()
  File "/home/saugat/repos/iterative/dvc/dvc/repo/__init__.py", line 129, in __init__
    self._ignore()
  File "/home/saugat/repos/iterative/dvc/dvc/repo/__init__.py", line 198, in _ignore
    self.scm.ignore_list(flist)
  File "/home/saugat/repos/iterative/dvc/dvc/scm/base.py", line 81, in ignore_list
    return [self.ignore(path) for path in p_list]
  File "/home/saugat/repos/iterative/dvc/dvc/scm/base.py", line 81, in <listcomp>
    return [self.ignore(path) for path in p_list]
  File "/home/saugat/repos/iterative/dvc/dvc/scm/git/__init__.py", line 187, in ignore
    entry, gitignore = self._get_gitignore(path)
  File "/home/saugat/repos/iterative/dvc/dvc/scm/git/__init__.py", line 171, in _get_gitignore
    if not path_isin(gitignore, os.path.realpath(self.root_dir)):
  File "/home/saugat/.pyenv/versions/3.6.6/lib/python3.6/posixpath.py", line 387, in realpath
    filename = os.fspath(filename)
TypeError: expected str, bytes or os.PathLike object, not NoneType
------------------------------------------------------------
Was this page helpful?
0 / 5 - 0 ratings

Related issues

pared picture pared  路  73Comments

drorata picture drorata  路  46Comments

ChrisHowlin picture ChrisHowlin  路  35Comments

kevin-hanselman picture kevin-hanselman  路  37Comments

jorgeorpinel picture jorgeorpinel  路  45Comments