Skip to content

Artifact does not get added to .gitignore on failed multi-add #4143

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

Closed
pared opened this issue Jul 1, 2020 · 0 comments
Closed

Artifact does not get added to .gitignore on failed multi-add #4143

pared opened this issue Jul 1, 2020 · 0 comments
Labels
bug Did we break something? p2-medium Medium priority, should be done, but less important

Comments

@pared
Copy link
Contributor

pared commented Jul 1, 2020

Following test passes:

def test_add_multiple_with_exception(tmp_dir, scm, dvc, mocker):
    tmp_dir.gen({"file": "file content", "other": "other file content"})
    original_move = dvc.cache.local.tree.move

    def raise_move(from_info, to_info, mode=None):
        if str(from_info) == "other":
            raise Exception
        else:
            original_move(from_info, to_info, mode)

    assert not (tmp_dir / ".gitignore").exists()
    mocker.patch.object(dvc.cache.local.tree, "move", side_effect=raise_move)
    try:
        dvc.add(["file", "other"])
    except:
        pass
    assert (tmp_dir / "file.dvc").exists()
    assert (tmp_dir / ".gitignore").exists()
    assert (tmp_dir / ".gitignore").read_text() == ''

How it should be?
.gitignore should contain file even though the whole add command failed. As of now, we end up successfully adding file to dvc but it is not ignored. At least we should be informed about potential problems.

@pared pared added bug Did we break something? p1-important Important, aka current backlog of things to do labels Jul 1, 2020
@efiop efiop added p2-medium Medium priority, should be done, but less important and removed p1-important Important, aka current backlog of things to do labels Jul 1, 2020
@efiop efiop closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Did we break something? p2-medium Medium priority, should be done, but less important
Projects
None yet
Development

No branches or pull requests

2 participants