Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

git_ui: Fix Trash Untracked Files with many files (#61602)

Tai Nguyen6c706fb928a7
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 1f880c59d35..8e800ffb500 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -2476,13 +2476,20 @@ impl GitPanel {
})
.collect::<Vec<_>>()
})?;
+ let total_count = tasks.len();
let to_unstage = to_delete
.into_iter()
.filter(|entry| !entry.status.staging().is_fully_unstaged())
.collect();
this.update(cx, |this, cx| this.change_file_stage(false, to_unstage, cx))?;
- for task in tasks {
- task.await?;
+
+ let results = futures::future::join_all(tasks).await;
+ let errors: Vec<anyhow::Error> = results.into_iter().filter_map(|r| r.err()).collect();
+ let failed_count = errors.len();
+ if let Some(first_error) = errors.into_iter().next() {
+ return Err(anyhow::anyhow!(
+ "Failed to trash {failed_count} of {total_count} files: {first_error:#}"
+ ));
}
Ok(())
})