Skip to main content

Module util

Module util 

Source
Expand description

Shared filesystem helpers: directory-size walk and filesystem-capacity probe.

The .git-skipping, hardlink-deduped walk lives here so guards, Manager, and downstream crates (iso-code-mcp) all agree on what counts as “worktree bytes.”

Functions§

dir_size_skipping_git
Sum the real on-disk size of every file under roots, skipping any .git/ subtree. Hardlinks are deduplicated per-walk by (dev, ino) on Unix. Silently ignores missing roots so callers don’t have to pre-filter.
filesystem_capacity_bytes
Return the total capacity in bytes of the filesystem hosting path. Picks the disk with the longest matching mount-point prefix. Returns None when the capacity cannot be determined (e.g. unsupported platform or path outside any known mount), so callers can skip the check.