Files
home-manager/tests/modules/programs/difftastic/difftastic-legacy-diff-tool-mode.nix
Austin Horstman 652f754686 difftastic: support difftool-only git integration
Splitting git diff tools into the separate programs.difftastic module
made it impossible to register difftastic as a git difftool without also
forcing it as diff.external, since the boolean git.diffToolMode only
toggled between "external" and "external + difftool".

Replace git.diffToolMode with a git.mode enum ("external", "difftool",
"both") so difftastic can be wired as the difftool only, leaving
`git diff` untouched. The deprecated boolean is migrated automatically
via mkChangedOptionModule (true -> "both", false -> "external"),
preserving existing behavior.

Fixes #8592
2026-06-18 07:45:53 -05:00

36 lines
1.2 KiB
Nix

{
lib,
options,
...
}:
{
programs.difftastic = {
enable = true;
git = {
enable = true;
diffToolMode = true;
};
options = {
color = "always";
display = "side-by-side";
};
};
programs.git.enable = true;
test.asserts.warnings.expected = [
"The option `programs.difftastic.git.diffToolMode' defined in ${lib.showFiles options.programs.difftastic.git.diffToolMode.files} has been changed to `programs.difftastic.git.mode' that has a different type. Please read `programs.difftastic.git.mode' documentation and update your configuration accordingly."
];
nmt.script = ''
assertFileExists home-files/.config/git/config
assertFileContains home-files/.config/git/config '[diff]'
# Legacy diffToolMode = true should map to mode = "both"
assertFileContains home-files/.config/git/config "external = \"@difftastic@/bin/difft '--color=always' '--display=side-by-side'\""
assertFileContains home-files/.config/git/config 'tool = "difftastic"'
assertFileContains home-files/.config/git/config '[difftool "difftastic"]'
assertFileContains home-files/.config/git/config "cmd = \"@difftastic@/bin/difft '--color=always' '--display=side-by-side' \$LOCAL \$REMOTE\""
'';
}