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: Add uncommit action (#37031)

Alvaro Parker0862a0b6661b
diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs
index 07a59de02a1..f64f001241e 100644
--- a/crates/git_ui/src/git_panel.rs
+++ b/crates/git_ui/src/git_panel.rs
@@ -1738,7 +1738,7 @@ impl GitPanel {
self.pending_commit = Some(task);
}
- fn uncommit(&mut self, window: &mut Window, cx: &mut Context<Self>) {
+ pub(crate) fn uncommit(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let Some(repo) = self.active_repository.clone() else {
return;
};
diff --git a/crates/git_ui/src/git_ui.rs b/crates/git_ui/src/git_ui.rs
index 5369b8b404b..ffb1a74728e 100644
--- a/crates/git_ui/src/git_ui.rs
+++ b/crates/git_ui/src/git_ui.rs
@@ -149,6 +149,14 @@ pub fn init(cx: &mut App) {
panel.unstage_all(action, window, cx);
});
});
+ workspace.register_action(|workspace, _: &git::Uncommit, window, cx| {
+ let Some(panel) = workspace.panel::<git_panel::GitPanel>(cx) else {
+ return;
+ };
+ panel.update(cx, |panel, cx| {
+ panel.uncommit(window, cx);
+ })
+ });
CommandPaletteFilter::update_global(cx, |filter, _cx| {
filter.hide_action_types(&[
zed_actions::OpenGitIntegrationOnboarding.type_id(),