Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def load(self, validate=True):
self.update(conf)

# Add resolved default cache.dir
if not self["cache"].get("dir"):
if not self["cache"].get("dir") and self.dvc_dir:
Comment thread
skshetry marked this conversation as resolved.
Outdated
self["cache"]["dir"] = os.path.join(self.dvc_dir, "cache")

def load_one(self, level):
Expand Down
7 changes: 6 additions & 1 deletion tests/func/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import configobj

from dvc.main import main
from dvc.config import ConfigError
from dvc.config import Config, ConfigError
from tests.basic_env import TestDvc


Expand Down Expand Up @@ -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)