Skip to content

files tracked by both git and dvc #4015

@efiop

Description

@efiop

While working on
https://github.com/iterative/dvc/pull/4005/files#diff-4e77f428386b79da1346596c02adbccbL56
we found a test that was pretty much force git adding a file that is gitignored and tracked by dvc:

        erepo_dir.dvc_gen("version", "updated")
        erepo_dir.scm.add(["version", "version.dvc"])
        erepo_dir.scm.commit("upgrade to DVC tracking")
        new_rev = erepo_dir.scm.get_rev()

we do check for such things when we dvc add/run/etc(basically whenever we save() the output), but we don't check for that after the fact, which might result in that output being constantly dirty from dvc standpoint (e.g. it has one md5, even though another one is recorded into out.dvc).

This doesn't happen unless the user done something like git add -f out to overcome .gitignore, so the chances of this happening are pretty slim, but it might result in some unexpected situations, so we should consider introducing additional checks to warn/prevent this from happening.

Kudos @pmrowla for the research.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?p2-mediumMedium priority, should be done, but less important

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions