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.

Refactor more code around commit button text (#25990)

Joseph T. Lyonsffe2bed1e299
diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs
index 0bd6b7e3eee..7096ad9fe9d 100644
--- a/crates/git_ui/src/commit_modal.rs
+++ b/crates/git_ui/src/commit_modal.rs
@@ -262,11 +262,7 @@ impl CommitModal {
.map(|b| b.name.clone())
})
.unwrap_or_else(|| "<no branch>".into());
- let tooltip = if git_panel.has_staged_changes() {
- "Commit staged changes"
- } else {
- "Commit changes to tracked files"
- };
+ let (_, tooltip) = git_panel.configure_commit_button(cx);
let title = git_panel.commit_button_title();
let co_authors = git_panel.render_co_authors(cx);
(branch, tooltip, title, co_authors)
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 2feefc3fe8c..331b496d480 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -1974,14 +1974,7 @@ impl GitPanel {
} else if !self.has_write_access(cx) {
(false, "You do not have write access to this project")
} else {
- (
- true,
- if self.has_staged_changes() {
- "Commit"
- } else {
- "Commit Tracked"
- },
- )
+ (true, self.commit_button_title())
}
}