refactor: one digest loop for files and streams

This commit is contained in:
Abdessamad Derraz committed 2026-11-18 21:42:28 +01:00
1 parent 88581cf95d
commit 2c8a9cfad8
11 files changed
+88 -98

No files matched your search

+1 -5
View File
@@ -27,10 +27,6 @@ class Upload:
reason: str = ""
def sha1_of(path: Path) -> str:
return file_digest(path)
def database_sha1(db: dict) -> dict[str, str]:
return {
entry["path"]: str(entry.get("sha1") or key).lower()
@@ -44,7 +40,7 @@ def plan_uploads(
db: dict,
gitignore_text: str,
findings: list,
hasher: Callable[[Path], str] = sha1_of,
hasher: Callable[[Path], str] = file_digest,
) -> list[Upload]:
"""Each out-of-date asset, cleared for upload or refused with its reason."""
names = asset_names([*registered_paths(gitignore_text),