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_panel: Use specific label and prompt for reverting deleted file (#61554)

Levin Rickertc29ba6c212e2
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 9f01b2271bf..8b9a790a708 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -2021,10 +2021,19 @@ impl GitPanel {
let prompt = if skip_prompt {
Task::ready(Ok(0))
} else {
+ let (message, confirm_text) = if entry.status.is_deleted() {
+ ("Are you sure you want to restore ", "Restore File")
+ } else {
+ (
+ "Are you sure you want to discard changes to ",
+ "Discard Changes",
+ )
+ };
let prompt = window.prompt(
PromptLevel::Warning,
&format!(
- "Are you sure you want to discard changes to {}?",
+ "{}{}?",
+ message,
MarkdownInlineCode(
entry
.repo_path
@@ -2033,7 +2042,7 @@ impl GitPanel {
),
),
None,
- &["Discard Changes", "Cancel"],
+ &[confirm_text, "Cancel"],
cx,
);
cx.background_spawn(prompt)
@@ -7225,6 +7234,8 @@ impl GitPanel {
};
let restore_title = if entry.status.is_created() {
"Trash File"
+ } else if entry.status.is_deleted() {
+ "Restore File"
} else {
"Discard Changes"
};