Skip to main content

judge

Function judge 

Source
pub fn judge(
    held: bool,
    age_seconds: Option<u64>,
    threshold: Option<u64>,
) -> WorkStanding
Expand description

Judge one work tree’s work from what holds it, its age and the threshold. The one place the verdict is decided.

use majordomus_cli::worktree::uncommitted::{judge, WorkStanding};
assert_eq!(judge(true, Some(10), Some(5)), WorkStanding::Held, "held is held, however old");
assert_eq!(judge(false, Some(10), Some(5)), WorkStanding::Abandoned);
assert_eq!(judge(false, Some(3), Some(5)), WorkStanding::Recent);
assert_eq!(judge(false, None, Some(5)), WorkStanding::Abandoned, "an unreadable age is not young");
assert_eq!(judge(false, Some(10), None), WorkStanding::Recent, "no threshold judges nothing old");