-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Bug Report
Description
When using dvc diff --targets to check changes for a specific file that is tracked inside a .dir (directory tracking), DVC reports the file as "Modified" even when the file's hash is identical between revisions.
Reproduction Steps
- Have a directory tracked with
.dvc(e.g.,SciLife_FFPE_batch3.dvc) - Between two commits, add new files to the directory (but don't modify existing files)
- Run
dvc diff --targets <path_to_unchanged_file> -- <old_rev> <new_rev>
Observed Behavior
$ dvc diff --targets SciLife_FFPE_batch3/P29252_1021/images/manual_alignment/P29252_1021_V42L21-320-A1.json --show-hash -- 6ff9c0fe2947 e727db11d0ca
Modified:
ef8f5c83..ef8f5c83 SciLife_FFPE_batch3/P29252_1021/images/manual_alignment/P29252_1021_V42L21-320-A1.json
files summary: 1 modifiedNote: The hash is identical on both sides (ef8f5c83..ef8f5c83), yet the file is reported as "Modified".
Expected Behavior
The file should not be reported as modified since its hash is unchanged. Either:
- Don't list it at all, or
- Show it as "Unchanged" if included
Verification
dvc list --show-hash confirms the file has the same hash at both revisions:
$ dvc list --show-hash --rev 6ff9c0fe2947 . SciLife_FFPE_batch3/P29252_1021/images/manual_alignment/P29252_1021_V42L21-320-A1.json
ef8f5c8338a1ab9794d8ec183edc218b P29252_1021_V42L21-320-A1.json
$ dvc list --show-hash --rev e727db11d0ca . SciLife_FFPE_batch3/P29252_1021/images/manual_alignment/P29252_1021_V42L21-320-A1.json
ef8f5c8338a1ab9794d8ec183edc218b P29252_1021_V42L21-320-A1.jsonEnvironment
- DVC version: 3.x (latest)
- OS: Linux
Analysis
It appears that when the parent directory's .dir manifest changes (e.g., new files added), dvc diff --targets incorrectly flags all files in that directory as "Modified" rather than checking individual file hashes.
This causes false positives when checking if a specific file has changed.