dvc: more explict error during init when .dvc is ignored by git (#4978)

* dvc: more explict error during init when .dvc is ignored by git

Fixes #3738

* dvc: address PR feedback

* styling

* styling
This commit is contained in:
Artem Dudarev
2020-11-30 21:00:17 +02:00
committed by GitHub
parent 09a88b8ea6
commit 38cbd998e1
6 changed files with 33 additions and 11 deletions
+14
View File
@@ -111,3 +111,17 @@ def test_gen_dvcignore(tmp_dir):
"# https://dvc.org/doc/user-guide/dvcignore\n"
)
assert text == (tmp_dir / ".dvcignore").read_text()
def test_init_when_ignored_by_git(tmp_dir, scm, caplog):
# https://github.com/iterative/dvc/issues/3738
tmp_dir.gen({".gitignore": ".*"})
with caplog.at_level(logging.ERROR, logger="dvc"):
assert main(["init"]) == 1
assert (
"{dvc_dir} is ignored by your SCM tool. \n"
"Make sure that it's tracked, "
"for example, by adding '!.dvc' to .gitignore.".format(
dvc_dir=tmp_dir / DvcRepo.DVC_DIR
)
) in caplog.text