mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
output: preserve legacy hash_name on save() for unchanged data
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
77e35145a9
commit
90b9193250
+1
-1
@@ -692,7 +692,7 @@ class Output:
|
||||
if self.metric:
|
||||
self.verify_metric()
|
||||
|
||||
if self.hash_name == "md5-dos2unix":
|
||||
if self.hash_name == "md5-dos2unix" and self.changed_checksum():
|
||||
self.hash_name = "md5"
|
||||
if self.use_cache:
|
||||
_, self.meta, self.obj = build(
|
||||
|
||||
@@ -316,9 +316,12 @@ def test_commit_dos2unix(tmp_dir, dvc):
|
||||
}
|
||||
)
|
||||
legacy_content = (tmp_dir / "foo.dvc").read_text()
|
||||
assert "hash: md5" not in legacy_content
|
||||
|
||||
dvc.commit("foo.dvc")
|
||||
dvc.commit("foo.dvc", force=True)
|
||||
assert (tmp_dir / "foo.dvc").read_text() == legacy_content
|
||||
|
||||
tmp_dir.gen("foo", "modified")
|
||||
dvc.commit("foo.dvc", force=True)
|
||||
content = (tmp_dir / "foo.dvc").read_text()
|
||||
assert "hash: md5" in content
|
||||
|
||||
Reference in New Issue
Block a user