From 94425051a1b9e6d16728c76e2d7007501e5e95be Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 22:55:26 -0500 Subject: [PATCH] Improve consistency with commit button tooltip between Git panel and modal (cherry-pick #25990) (#25991) Cherry-picked Refactor more code around commit button text (#25990) Missed this when doing https://github.com/zed-industries/zed/pull/25988 Release Notes: - N/A Co-authored-by: Joseph T. Lyons --- crates/git_ui/src/commit_modal.rs | 6 +----- crates/git_ui/src/git_panel.rs | 9 +-------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/crates/git_ui/src/commit_modal.rs b/crates/git_ui/src/commit_modal.rs index 0bd6b7e3eeeda7028e81f5e6dea9d4ef969f974e..7096ad9fe9de7e89921971af65b90fcc6a6198dc 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(|| "".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 2feefc3fe8caf6b3a4ffe2d22b4dd8dad6a78e54..331b496d4800be854a9cabcb5d9c113d43dc0393 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()) } }