-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dvc get can can delete the current directory #3105
Comments
Hi @Persedes ! Wow, that is awful. Investigating right now. Thank you for reporting it! 🙏 |
Indeed, the issue is caused by dvc being confused by the trailing |
Reproduction script:
Expected behavior:
|
I have found another oddity, which might be related to the bug above. The first
|
@efiop , are you working on this one? |
Nesting only happens once, this is due to Lines 336 to 344 in fe635a5
@efiop ? |
@pared , I was trying to write a test based on your reproduction script. But didn't understand why you were By the way, here's what I have so far: def test_error(tmp_dir, dvc, erepo_dir):
with tempfile.TemporaryDirectory() as remote:
git.Repo.init(remote)
with erepo_dir.chdir():
erepo_dir.scm_gen("dir/file", "text", commit="create file")
erepo_dir.dvc_add("dir")
origin = erepo_dir.scm.repo.create_remote("origin", remote)
origin.push()
os.remove(fspath(erepo_dir / "dir" / "file"))
shutil.rmtree(fspath(erepo_dir / ".dvc" / "cache"))
dvc.get(erepo_dir, "dir")
assert git.Repo(remote) It passes, so I'm not sure if I'm translating it correctly 😕 |
@MrOutis, [EDIT] def test_error(tmp_dir, dvc, erepo_dir):
with erepo_dir.chdir():
erepo_dir.gen("dir/file", "text") # just gen here, not scm_gen
erepo_dir.dvc_add("dir", commit="add dir")
os.remove(fspath(erepo_dir / "dir" / "file"))
shutil.rmtree(fspath(erepo_dir / ".dvc" / "cache"))
try:
with mock.patch("dvc.prompt.confirm", return_value=True):
dvc.get(fspath(erepo_dir), "dir/") # note that we get "dir/" not "dir"
except Exception:
pass
finally:
assert tmp_dir.exists() |
@pared , great! Thanks for clearing it out) |
@pared , I still don't get it. Tests are passing on my side, I'm loosing it on this one 😅 |
@MrOutis even the one that I provided? |
@Persedes I did a little patch that should fix the original issue, as to the second one, the one described in #3105 (comment). I am afraid that has to stay. I do agree that in this particular case it does not do what you would like it to do, but this behaviour is consistent with what filesystem operations allow as to do.
Will show that the second cp will create |
First off, I saw it coming, had my stuff backed up etc, so no harm done.
I was trying to test out dvc get to pull models from a different project and the cache must not have been present in the remote:
models/mlr/production
is defined as the output of a dvc file.Once I saw the
File '.' won't be created. file '.' is going to be removed.
I knew what was going to happen, but was surprised that dvc lets you do that. (It wiped out my whole git repo ;))DVC version 0.80.0,
Platform WSL
method of installation: pip
The text was updated successfully, but these errors were encountered: