mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-18 15:28:28 +01:00
output: check legacy hash name in output.add()
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
276d499c9b
commit
e995492095
+6
-2
@@ -692,8 +692,7 @@ class Output:
|
||||
if self.metric:
|
||||
self.verify_metric()
|
||||
|
||||
if self.hash_name == "md5-dos2unix" and self.changed_checksum():
|
||||
self.hash_name = "md5"
|
||||
self._update_legacy_hash_name()
|
||||
if self.use_cache:
|
||||
_, self.meta, self.obj = build(
|
||||
self.cache,
|
||||
@@ -717,6 +716,10 @@ class Output:
|
||||
self.hash_info = self.obj.hash_info
|
||||
self.files = None
|
||||
|
||||
def _update_legacy_hash_name(self):
|
||||
if self.hash_name == "md5-dos2unix" and self.changed_checksum():
|
||||
self.hash_name = "md5"
|
||||
|
||||
def set_exec(self) -> None:
|
||||
if self.isfile() and self.meta.isexec:
|
||||
self.cache.set_exec(self.fs_path)
|
||||
@@ -1338,6 +1341,7 @@ class Output:
|
||||
)
|
||||
|
||||
assert self.repo
|
||||
self._update_legacy_hash_name()
|
||||
cache = self.cache if self.use_cache else self.local_cache
|
||||
assert isinstance(cache, HashFileDB)
|
||||
|
||||
|
||||
@@ -784,6 +784,7 @@ def test_add_preserve_fields(tmp_dir, dvc):
|
||||
remote: testremote
|
||||
md5: acbd18db4cc2f85cedef654fccc4a4d8
|
||||
size: 3
|
||||
hash: md5
|
||||
meta: some metadata
|
||||
"""
|
||||
)
|
||||
@@ -975,6 +976,7 @@ def test_add_updates_to_cloud_versioning_dir(tmp_dir, dvc):
|
||||
"outs": [
|
||||
{
|
||||
"path": "data",
|
||||
"hash": "md5",
|
||||
"files": [
|
||||
{
|
||||
"size": 3,
|
||||
@@ -1007,6 +1009,7 @@ def test_add_updates_to_cloud_versioning_dir(tmp_dir, dvc):
|
||||
"outs": [
|
||||
{
|
||||
"path": "data",
|
||||
"hash": "md5",
|
||||
"files": [
|
||||
{
|
||||
"size": 4,
|
||||
|
||||
Reference in New Issue
Block a user