config: use local config from local_dvc_dir

This used to work like so but by accident, when we didn't reload config
at all when collecting other revisions.

Regression from https://github.com/iterative/dvc/pull/9758
This commit is contained in:
Ruslan Kuprieiev
2023-08-10 04:36:42 +03:00
parent 4f61a63afd
commit 09cfd911bb
2 changed files with 9 additions and 1 deletions
+8 -1
View File
@@ -90,6 +90,7 @@ class Config(dict):
def __init__(
self,
dvc_dir: Optional["StrPath"] = None,
local_dvc_dir: Optional["StrPath"] = None,
validate: bool = True,
fs: Optional["FileSystem"] = None,
config: Optional["DictStrAny"] = None,
@@ -105,6 +106,10 @@ class Config(dict):
if dvc_dir:
self.dvc_dir = self.fs.path.abspath(dvc_dir)
self.local_dvc_dir = local_dvc_dir
if not fs and not local_dvc_dir:
self.local_dvc_dir = dvc_dir
self.load(
validate=validate, config=config, remote=remote, remote_config=remote_config
)
@@ -140,7 +145,9 @@ class Config(dict):
if self.dvc_dir is not None:
files["repo"] = self.fs.path.join(self.dvc_dir, self.CONFIG)
files["local"] = self.fs.path.join(self.dvc_dir, self.CONFIG_LOCAL)
if self.local_dvc_dir is not None:
files["local"] = self.wfs.path.join(self.local_dvc_dir, self.CONFIG_LOCAL)
return files
+1
View File
@@ -244,6 +244,7 @@ class Repo:
return Config(
self.dvc_dir,
local_dvc_dir=self.local_dvc_dir,
fs=self.fs,
config=self._config,
remote=self._remote,