mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-13 15:28:27 +01:00
objects: don't recompute hash on odb.add() if verify is False (#5860)
This commit is contained in:
+11
-1
@@ -1,4 +1,6 @@
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
|
||||
from .errors import ObjectFormatError
|
||||
|
||||
@@ -35,9 +37,17 @@ class HashFile:
|
||||
and self.hash_info == other.hash_info
|
||||
)
|
||||
|
||||
def check(self, odb):
|
||||
def check(self, odb, check_hash=True):
|
||||
from .stage import get_file_hash
|
||||
|
||||
if not check_hash:
|
||||
if not self.fs.exists(self.path_info):
|
||||
raise FileNotFoundError(
|
||||
errno.ENOENT, os.strerror(errno.ENOENT), self.path_info
|
||||
)
|
||||
else:
|
||||
return None
|
||||
|
||||
actual = get_file_hash(
|
||||
self.path_info, self.fs, self.hash_info.name, odb.repo.state
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user