Replace gix with configurable libgit2 diffs

This commit is contained in:
Georg Bauer
2026-07-28 18:25:24 +02:00
parent ed2226bc60
commit 31f6426eef
9 changed files with 410 additions and 1295 deletions

View File

@@ -183,6 +183,65 @@ impl App {
]
.spacing(10),
);
let git_group = preference_group(
PreferenceSection::Git,
"GIT DIFFS",
column![
row![
hint(
text("Algorithm").size(13).width(Length::Fill),
"Default uses libgit2's Myers diff. Patience favors unique matching lines; Minimal spends more time finding the smallest edit script.",
),
pick_list(
&GIT_DIFF_ALGORITHMS[..],
Some(self.preference_draft.git_diff_algorithm),
Message::PreferenceGitDiffAlgorithmChanged,
)
.width(240),
]
.spacing(12)
.align_y(Alignment::Center),
preference_input_row(
"Context lines",
"Unchanged lines shown before and after each changed block. libgit2 defaults to 3.",
text_input("3", &self.preference_draft.git_context_lines)
.on_input(Message::PreferenceGitContextLinesChanged),
),
preference_input_row(
"Interhunk lines",
"Merge nearby changed blocks when no more than this many unchanged lines separate them. Zero keeps libgit2's default separation.",
text_input("0", &self.preference_draft.git_interhunk_lines)
.on_input(Message::PreferenceGitInterhunkLinesChanged),
),
row![
hint(
text("Whitespace").size(13).width(Length::Fill),
"Controls which whitespace-only edits libgit2 omits from the displayed diff.",
),
pick_list(
&GIT_DIFF_WHITESPACE_MODES[..],
Some(self.preference_draft.git_whitespace),
Message::PreferenceGitWhitespaceChanged,
)
.width(240),
]
.spacing(12)
.align_y(Alignment::Center),
hint(
checkbox(self.preference_draft.git_indent_heuristic)
.label("Use indentation heuristic")
.on_toggle(Message::PreferenceGitIndentHeuristicChanged),
"Shift ambiguous hunk boundaries toward indentation changes, which usually makes source-code diffs easier to read.",
),
hint(
checkbox(self.preference_draft.git_ignore_blank_lines)
.label("Ignore blank-line changes")
.on_toggle(Message::PreferenceGitIgnoreBlankLinesChanged),
"Hide hunks whose changed lines are all blank.",
),
]
.spacing(10),
);
let generation_group = preference_group(
PreferenceSection::Generation,
"GENERATION",
@@ -580,6 +639,7 @@ impl App {
model_group,
endpoint_group,
dev_brain_group,
git_group,
generation_group,
execution_group,
acceleration_group,