Skip to content

Commit 92dbc6c

Browse files
committed
scm: fix clone
`fetch_all_exp` was being invoked with url set to "origin", which caused any credentials in the provided url to be ignored Fixes iterative#7670
1 parent dc1d3e8 commit 92dbc6c

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

dvc/scm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def clone(url: str, to_path: str, **kwargs):
125125
try:
126126
git = Git.clone(url, to_path, progress=pbar.update_git, **kwargs)
127127
if "shallow_branch" not in kwargs:
128-
fetch_all_exps(git, "origin", progress=pbar.update_git)
128+
fetch_all_exps(git, url, progress=pbar.update_git)
129129
return git
130130
except InternalCloneError as exc:
131131
raise CloneError(str(exc))

tests/func/test_api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_get_url_external(tmp_dir, erepo_dir, cloud):
2020
erepo_dir.dvc_gen("foo", "foo", commit="add foo")
2121

2222
# Using file url to force clone to tmp repo
23-
repo_url = f"file://{erepo_dir}"
23+
repo_url = f"file://{erepo_dir.as_posix()}"
2424
expected_url = (cloud / "ac/bd18db4cc2f85cedef654fccc4a4d8").url
2525
assert api.get_url("foo", repo=repo_url) == expected_url
2626

@@ -51,7 +51,7 @@ def test_open_external(tmp_dir, erepo_dir, cloud):
5151
remove(erepo_dir.dvc.odb.local.cache_dir)
5252

5353
# Using file url to force clone to tmp repo
54-
repo_url = f"file://{erepo_dir}"
54+
repo_url = f"file://{erepo_dir.as_posix()}"
5555
with api.open("version", repo=repo_url) as fd:
5656
assert fd.read() == "master"
5757

@@ -223,6 +223,8 @@ def test_open_from_remote(tmp_dir, erepo_dir, cloud, local_cloud):
223223
remove(erepo_dir.dvc.odb.local.cache_dir)
224224

225225
with api.open(
226-
os.path.join("dir", "foo"), repo=f"file://{erepo_dir}", remote="other"
226+
os.path.join("dir", "foo"),
227+
repo=f"file://{erepo_dir.as_posix()}",
228+
remote="other",
227229
) as fd:
228230
assert fd.read() == "foo content"

0 commit comments

Comments
 (0)