pub fn covers(claim: &str, path: &str) -> boolExpand description
Whether a claim on claim covers a write to path: the same path, an ancestor of it,
or the whole repository (.).
use majordomus_cli::guard::covers;
assert!(covers("lib", "lib/capture.sh"));
assert!(covers("lib/capture.sh", "lib/capture.sh"));
assert!(covers(".", "docs/MESH.md"), "a claim on the root covers everything");
assert!(covers("lib/", "lib/a.sh"), "a trailing slash is the same directory");
assert!(!covers("lib/capture.sh", "lib"), "a file does not cover its directory");
assert!(!covers("li", "lib/a.sh"), "a prefix of a name is not an ancestor");
assert!(!covers("", "lib/a.sh"));