-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
treeverse/scmrepo
#239Labels
bugDid we break something?Did we break something?gitRelated to git and git backendsRelated to git and git backendsupstreamIssues which need to be resolved in an upstream dependencyIssues which need to be resolved in an upstream dependency
Description
Bug Report
Description
When pulling a dvc file that is dvc imported from the same git repo (using . for the url) in detached HEAD (eg. in CI), the cloning step raise the following error:
2023-03-28 14:09:35,165 ERROR: failed to pull data from the cloud - SCM error: Failed to clone repo '../' to '/tmp/tmpl_adca1idvc-clone': neither origin_head nor branch are provided
Traceback (most recent call last):
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/scmrepo/git/backend/dulwich/__init__.py", line 219, in clone
repo = clone_from()
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/dulwich/porcelain.py", line 508, in clone
return client.clone(
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/dulwich/client.py", line 716, in clone
head_ref = _set_default_branch(
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/dulwich/refs.py", line 1221, in _set_default_branch
raise ValueError('neither origin_head nor branch are provided')
ValueError: neither origin_head nor branch are provided
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/dvc/scm.py", line 160, in clone
git = Git.clone(url, to_path, progress=pbar.update_git, **kwargs)
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/scmrepo/git/__init__.py", line 142, in clone
backend.clone(url, to_path, **kwargs)
File "/__w/speech-lab/speech-lab/modelling/.venv/lib/python3.9/site-packages/scmrepo/git/backend/dulwich/__init__.py", line 224, in clone
raise CloneError(url, to_path) from exc
scmrepo.exceptions.CloneError: Failed to clone repo '../' to '/tmp/tmpl_adca1idvc-clone'
The issue appears even if I use cml ci --fetch-depth=0 or:
uses: actions/checkout@v3
with:
fetch-depth: 0Reproduce
dvc import a file from the same repo and dvc pull this file in datached mode.
Also, We have two dvc instances in the same git repo in two subdirectories.
Expected
I expect no exception or a clearer one.
Environment information
The problem only appear in a CI environment where the repo is detached from HEAD.
[UPDATE]: I was able to reproduce it locally by being in detached mode.
Output of dvc doctor:
DVC version: 2.51.0 (pip)
-------------------------
Platform: Python 3.9.5 on Linux-4.14.304-226.531.amzn2.x86_64-x86_64-with-glibc2.31
Subprojects:
dvc_data = 0.44.1
dvc_objects = 0.21.1
dvc_render = 0.3.1
dvc_task = 0.2.0
scmrepo = 0.1.17
Supports:
http (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
https (aiohttp = 3.8.1, aiohttp-retry = 2.8.3),
s3 (s3fs = 2023.1.0, boto3 = 1.24.59)
Cache types: symlink
Cache directory: lustre on 172.31.75.85@tcp:/o4e3rbev
Caches: local
Remotes: s3, s3
Workspace directory: xfs on /dev/nvme0n1p1
Repo: dvc (subdir), git
Repo.site_cache_dir: /var/tmp/dvc/repo/639387cceca8b895ded2b9292d87a036Metadata
Metadata
Assignees
Labels
bugDid we break something?Did we break something?gitRelated to git and git backendsRelated to git and git backendsupstreamIssues which need to be resolved in an upstream dependencyIssues which need to be resolved in an upstream dependency