Radish alpha
r
Radicle terminal user interface
Radicle
Git (anonymous pull)
Log in to clone via SSH
cob: Guarantee there is always a latest revision
Alexis Sellier committed 2 years ago
commit 7e15b273a0f8ef51c306bbd9f47b202df5089254
parent cd07a1d0e0765a0b61671b942814e69e5c1a39b1
2 files changed +3 -5
modified radicle-tui/src/cob/patch.rs
@@ -26,7 +26,7 @@ pub fn load_proposed(repository: &Repository) -> Result<Vec<(PatchId, Patch)>> {
}

pub fn sync_status(repository: &Repository, patch: &Patch) -> Result<(usize, usize)> {
-
    let (_, revision) = patch.latest().unwrap();
+
    let (_, revision) = patch.latest();
    let target_oid = merge_target_oid(patch.target(), repository)?;
    let (ahead, behind) = repository
        .raw()
modified radicle-tui/src/ui/cob/patch.rs
@@ -49,10 +49,8 @@ pub fn format_timestamp(patch: &Patch) -> String {
}

pub fn format_comments(patch: &Patch) -> String {
-
    let count = match patch.latest() {
-
        Some((_, rev)) => rev.discussion().len(),
-
        None => 0,
-
    };
+
    let count: usize = patch.revisions().map(|(_, r)| r.discussion().len()).sum();
+

    format!("{count}")
}