mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-01 23:08:43 +01:00
@@ -200,7 +200,7 @@ def _clone_default_branch(url, rev):
|
||||
if clone_path:
|
||||
git = Git(clone_path)
|
||||
# Do not pull for known shas, branches and tags might move
|
||||
if not Git.is_sha(rev) or not git.is_known(rev):
|
||||
if not Git.is_sha(rev) or not git.has_rev(rev):
|
||||
git.pull()
|
||||
else:
|
||||
clone_path = tempfile.mkdtemp("dvc-clone")
|
||||
|
||||
@@ -56,3 +56,18 @@ def test_cache_reused(erepo_dir, mocker):
|
||||
with external_repo(url, "branch") as repo:
|
||||
repo.fetch()
|
||||
assert download_spy.mock.call_count == 1
|
||||
|
||||
|
||||
def test_known_sha(erepo_dir):
|
||||
url = "file://{}".format(erepo_dir)
|
||||
with external_repo(url) as repo:
|
||||
rev = repo.scm.get_rev()
|
||||
prev_rev = repo.scm.resolve_rev("HEAD^")
|
||||
|
||||
# Hits cache
|
||||
with external_repo(url, rev) as repo:
|
||||
pass
|
||||
|
||||
# No clone, no pull, copies a repo, checks out the known sha
|
||||
with external_repo(url, prev_rev) as repo:
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user