fix(v2): support nested repository paths
This commit is contained in:
@@ -64,7 +64,13 @@ def _canonical_json(payload: dict[str, object]) -> str:
|
||||
|
||||
|
||||
def _assert_capacity(settings: Settings, root: Path) -> None:
|
||||
usage = shutil.disk_usage(root)
|
||||
capacity_root = root
|
||||
while not capacity_root.exists():
|
||||
parent = capacity_root.parent
|
||||
if parent == capacity_root:
|
||||
raise RepositoryError("repository root is unreadable")
|
||||
capacity_root = parent
|
||||
usage = shutil.disk_usage(capacity_root)
|
||||
free_percent = usage.free * 100 / usage.total
|
||||
if usage.free < settings.min_free_bytes or free_percent < settings.min_free_percent:
|
||||
raise RepositoryError("repository root does not meet minimum free capacity")
|
||||
|
||||
Reference in New Issue
Block a user