Persist the default Git diff layout

This commit is contained in:
Georg Bauer
2026-07-28 19:07:59 +02:00
parent 07c89094b4
commit 191ff0b2ce
7 changed files with 64 additions and 21 deletions

View File

@@ -40,13 +40,6 @@ pub(super) struct GitWorktree {
pub(super) files: Vec<GitFile>,
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub(crate) enum GitDiffMode {
#[default]
Unified,
Split,
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub(super) enum GitDiffLineKind {
Section,
@@ -186,6 +179,7 @@ impl App {
match load_diff(&worktree.root, file, &self.config.git) {
Ok(diff) => {
self.git_diff = Some(diff);
self.git_diff_layout = self.config.git.diff_layout;
self.error = None;
}
Err(error) => self.error = Some(error),
@@ -1113,6 +1107,7 @@ mod tests {
.find(|file| file.display_path == "changed.txt")
.unwrap();
let settings = GitConfig {
diff_layout: GitDiffLayout::Unified,
diff_algorithm: GitDiffAlgorithm::Patience,
context_lines: 0,
interhunk_lines: 0,