From 8b222e4038b5b146b1610135e232ab6fbb94ef9d Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 15 Aug 2024 10:29:13 +0900 Subject: [PATCH] cli: propagate BackendError from tree diffs --- cli/src/diff_util.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index a7b5521446..c09871a4e8 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -1187,7 +1187,7 @@ pub fn show_diff_summary( to_tree: &MergedTree, matcher: &dyn Matcher, copy_records: &CopyRecords, -) -> io::Result<()> { +) -> Result<(), DiffRenderError> { let mut tree_diff = from_tree.diff_stream(to_tree, matcher, copy_records); let copied_sources = collect_copied_sources(copy_records, matcher); @@ -1198,7 +1198,7 @@ pub fn show_diff_summary( value: diff, }) = tree_diff.next().await { - let (before, after) = diff.unwrap(); + let (before, after) = diff?; if before_path != after_path { let path = path_converter.format_copied_path(&before_path, &after_path); if to_tree.path_value(&before_path).unwrap().is_absent() { @@ -1220,10 +1220,9 @@ pub fn show_diff_summary( } } } - Ok::<(), io::Error>(()) + Ok(()) } - .block_on()?; - Ok(()) + .block_on() } struct DiffStat { @@ -1361,7 +1360,7 @@ pub fn show_types( to_tree: &MergedTree, matcher: &dyn Matcher, copy_records: &CopyRecords, -) -> io::Result<()> { +) -> Result<(), DiffRenderError> { let mut tree_diff = from_tree.diff_stream(to_tree, matcher, copy_records); let copied_sources = collect_copied_sources(copy_records, matcher); @@ -1372,7 +1371,7 @@ pub fn show_types( value: diff, }) = tree_diff.next().await { - let (before, after) = diff.unwrap(); + let (before, after) = diff?; if after.is_absent() && copied_sources.contains(source.as_ref()) { continue; }