Bring the Rust git panel to TS parity across four surfaces:
- Commit rows expand inline into a semantic diff card (ported
diffDocuments / indexNodesById / engineDiff over serde_json::Value)
instead of navigating to a separate diff page; the card shows the
"~modify N nodes" summary plus a per-node patch list. blob_at_commit
reads the {rev} and {rev}^ blobs to compute base-vs-next.
- Overflow menu (...) with the 5 TS actions — switch tracked file, clear
commit author, remote settings, SSH keys, close repository — backed by
GitOverflowView subviews (tracked-file picker + SSH-keys list) and
remote-settings rows (origin URL + ahead/behind + fetch; no HTTPS token
field, matching TS).
- Commit signature form: empty commits are refused, and committing with no
configured author opens an inline name/email form (Enter saves, Escape
cancels) that writes the repo-local identity before retrying the commit.
- Polish: taller commit-detail card, removed panel shadow, lengthened the
ready panel, and unified the commit-textarea caret blink to the app's
500 ms cadence.
New overflow/SSH/author/remote labels resolve via Document::t with an
English fallback for keys not yet in the locale tables.
37 lines
1.4 KiB
Rust
37 lines
1.4 KiB
Rust
//! Host glue for the commit-detail card's semantic diff — kept out of the
|
|
//! already-large `git_host.rs`. Reads the expanded commit + its tracked file,
|
|
//! computes the node diff against the parent (`commit_diff_semantic`), and
|
|
//! lands the result on the panel.
|
|
|
|
use op_editor_core::CommitDiffView;
|
|
|
|
use crate::DesktopApp;
|
|
|
|
impl DesktopApp {
|
|
/// Compute `recent_commits[index]`'s semantic diff against its parent
|
|
/// (TS `computeDiff`) and store it in the panel for the inline card.
|
|
pub(crate) fn load_expanded_commit_diff(&mut self, index: usize) {
|
|
let commit = self
|
|
.host
|
|
.editor_state()
|
|
.editor_ui
|
|
.git_panel
|
|
.recent_commits
|
|
.get(index)
|
|
.cloned();
|
|
let relpath = self.git_session.tracked_relpath();
|
|
let view = match (self.git_session.repo(), relpath, commit) {
|
|
(Some(repo), Some(relpath), Some(commit)) => {
|
|
crate::commit_diff_semantic::load_commit_diff(repo, &relpath, &commit)
|
|
}
|
|
_ => CommitDiffView::Error("no tracked file in this repository".to_string()),
|
|
};
|
|
// Only land the result if that row is still expanded — a fast
|
|
// collapse / re-expand could have moved on.
|
|
let panel = &mut self.host.editor_state_mut().editor_ui.git_panel;
|
|
if panel.expanded_commit == Some(index) {
|
|
panel.expanded_commit_diff = Some(view);
|
|
}
|
|
}
|
|
}
|