Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -991,11 +991,30 @@ impl App {
self.status_tab.abort_rebase();
}
Action::UndoCommit => {
// Get commit message before undoing
let commit_msg = sync::get_head(&self.repo.borrow())
.ok()
.and_then(|head_id| {
sync::get_commit_details(
&self.repo.borrow(),
head_id,
)
.ok()
})
.and_then(|details| details.message)
.map(|msg| msg.combine());

// Undo the commit
try_or_popup!(
self,
"undo commit failed:",
undo_last_commit(&self.repo.borrow())
);

// Preload the message and set commit popup text
if let Some(msg) = commit_msg {
self.commit_popup.set_commit_msg(msg);
}
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/popups/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ impl CommitPopup {

Ok(msg)
}

/// Set commit message text (e.g., for preloading after undo)
pub fn set_commit_msg(&mut self, msg: String) {
self.input.set_text(msg);
}
}

impl DrawableComponent for CommitPopup {
Expand Down
Loading