@@ -33,7 +33,7 @@ class FolderVerification:
3333 mismatches : list [Mismatch ]
3434 missing_paths : list [str ]
3535 extra_paths : list [str ]
36- verified_path : Optional [ Path ] = None
36+ verified_path : Path
3737
3838
3939def collect_local_files (root : Path ) -> dict [str , Path ]:
@@ -76,7 +76,7 @@ def _resolve_commit_hash_from_cache(storage_folder: Path, revision: Optional[str
7676 )
7777
7878
79- def compute_file_hash (path : Path , algorithm : HashAlgo , * , git_hash_cache : dict [ Path , str ] ) -> str :
79+ def compute_file_hash (path : Path , algorithm : HashAlgo ) -> str :
8080 """
8181 Compute the checksum of a local file using the requested algorithm.
8282 """
@@ -86,19 +86,18 @@ def compute_file_hash(path: Path, algorithm: HashAlgo, *, git_hash_cache: dict[P
8686 return sha_fileobj (stream ).hex ()
8787
8888 if algorithm == "git-sha1" :
89- try :
90- return git_hash_cache [path ]
91- except KeyError :
92- with path .open ("rb" ) as stream :
93- digest = git_hash (stream .read ())
94- git_hash_cache [path ] = digest
95- return digest
89+ with path .open ("rb" ) as stream :
90+ return git_hash (stream .read ())
9691
9792 raise ValueError (f"Unsupported hash algorithm: { algorithm } " )
9893
9994
10095def verify_maps (
101- * , remote_by_path : dict [str , Union ["RepoFile" , "RepoFolder" ]], local_by_path : dict [str , Path ], revision : str
96+ * ,
97+ remote_by_path : dict [str , Union ["RepoFile" , "RepoFolder" ]],
98+ local_by_path : dict [str , Path ],
99+ revision : str ,
100+ verified_path : Path ,
102101) -> FolderVerification :
103102 """Compare remote entries and local files and return a verification result."""
104103 remote_paths = set (remote_by_path )
@@ -109,7 +108,6 @@ def verify_maps(
109108 both = sorted (remote_paths & local_paths )
110109
111110 mismatches : list [Mismatch ] = []
112- git_hash_cache : dict [Path , str ] = {}
113111
114112 for rel_path in both :
115113 remote_entry = remote_by_path [rel_path ]
@@ -127,7 +125,7 @@ def verify_maps(
127125 algorithm = "git-sha1"
128126 expected = str (blob_id ).lower ()
129127 try :
130- actual = compute_file_hash (local_path , algorithm , git_hash_cache = git_hash_cache )
128+ actual = compute_file_hash (local_path , algorithm )
131129 except OSError as exc :
132130 mismatches .append (
133131 Mismatch (path = rel_path , expected = "<unavailable>" , actual = f"io-error:{ exc } " , algorithm = "io" )
@@ -143,6 +141,7 @@ def verify_maps(
143141 mismatches = mismatches ,
144142 missing_paths = missing ,
145143 extra_paths = extra ,
144+ verified_path = verified_path ,
146145 )
147146
148147
0 commit comments