Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Make sure diff stats match `git`
cloudhead committed 2 years ago
commit 9341d51d0522fd586505a835d00fa47d7fe7111d
parent af095d53ca79d7cc6355d147e8c3990d53c8fde0
1 file changed +4 -1
modified radicle-cli/src/commands/patch/common.rs
@@ -41,6 +41,7 @@ pub fn get_merge_target(
}

/// Get the diff stats between two commits.
+
/// Should match the default output of `git diff <old> <new> --stat` exactly.
pub fn diff_stats(
    repo: &git::raw::Repository,
    old: &Oid,
@@ -50,8 +51,10 @@ pub fn diff_stats(
    let new = repo.find_commit(*new)?;
    let old_tree = old.tree()?;
    let new_tree = new.tree()?;
-
    let diff = repo.diff_tree_to_tree(Some(&old_tree), Some(&new_tree), None)?;
+
    let mut diff = repo.diff_tree_to_tree(Some(&old_tree), Some(&new_tree), None)?;
+
    let mut find_opts = git::raw::DiffFindOptions::new();

+
    diff.find_similar(Some(&mut find_opts))?;
    diff.stats()
}