dvc: do not set cache dir if not a dvc repo (#3329)

This commit is contained in:
Saugat Pachhai
2020-02-14 19:07:23 +02:00
committed by GitHub
parent 6932cf6c8d
commit 77f24af727
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -278,7 +278,7 @@ class Config(dict):
self.update(conf)
# Add resolved default cache.dir
if not self["cache"].get("dir"):
if not self["cache"].get("dir") and self.dvc_dir:
self["cache"]["dir"] = os.path.join(self.dvc_dir, "cache")
def load_one(self, level):
+6 -1
View File
@@ -2,7 +2,7 @@ import pytest
import configobj
from dvc.main import main
from dvc.config import ConfigError
from dvc.config import Config, ConfigError
from tests.basic_env import TestDvc
@@ -101,3 +101,8 @@ def test_merging_two_levels(dvc):
"url": "ssh://example.com",
"password": "1",
}
def test_config_loads_without_error_for_non_dvc_repo(tmp_dir):
# regression testing for https://github.com/iterative/dvc/issues/3328
Config(validate=True)