Skip to main content

judge

Function judge 

Source
pub fn judge(
    root: &Path,
    path: &str,
    session: Option<&str>,
    claims: impl FnOnce() -> ClaimSource,
) -> EditVerdict
Expand description

Judge an edit of path by session in the checkout at root, reading every fact. claims is asked only when the cheaper facts have not already decided.

use majordomus_cli::guard::judge;

let dir = tempfile::tempdir().unwrap();
// no manifest, so no policy: nothing is enforced, and the mesh is never asked
let v = judge(dir.path(), "a.md", None, || unreachable!("the claims are not needed"));
assert!(v.allowed);
assert_eq!((v.path.as_str(), v.ground.as_str()), ("a.md", "undecided"));