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 visual optimistic staging bug for tree view (#48078)

Remco Smits9101f0ffc96a
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 0bd1b46a5e9..c57150355f1 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -1737,19 +1737,25 @@ impl GitPanel {
return StageStatus::Unstaged;
};
+ let show_placeholders = self.show_placeholders && !self.has_staged_changes();
let mut fully_staged_count = 0usize;
let mut any_staged_or_partially_staged = false;
for descendant in descendants {
- match GitPanel::stage_status_for_entry(descendant, repo) {
- StageStatus::Staged => {
- fully_staged_count += 1;
- any_staged_or_partially_staged = true;
- }
- StageStatus::PartiallyStaged => {
- any_staged_or_partially_staged = true;
+ if show_placeholders && !descendant.status.is_created() {
+ fully_staged_count += 1;
+ any_staged_or_partially_staged = true;
+ } else {
+ match GitPanel::stage_status_for_entry(descendant, repo) {
+ StageStatus::Staged => {
+ fully_staged_count += 1;
+ any_staged_or_partially_staged = true;
+ }
+ StageStatus::PartiallyStaged => {
+ any_staged_or_partially_staged = true;
+ }
+ StageStatus::Unstaged => {}
}
- StageStatus::Unstaged => {}
}
}