mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
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
30 lines
892 B
Nix
30 lines
892 B
Nix
{
|
|
programs.difftastic = {
|
|
enable = true;
|
|
git = {
|
|
enable = true;
|
|
mode = "external";
|
|
};
|
|
options = {
|
|
color = "always";
|
|
display = "side-by-side";
|
|
override = [
|
|
"*.mill:Scala"
|
|
"*.yuck:Emacs Lisp"
|
|
];
|
|
};
|
|
};
|
|
|
|
programs.git.enable = true;
|
|
|
|
nmt.script = ''
|
|
assertFileExists home-files/.config/git/config
|
|
assertFileContains home-files/.config/git/config '[diff]'
|
|
# Should have diff.external set
|
|
assertFileContains home-files/.config/git/config "external = \"@difftastic@/bin/difft '--color=always' '--display=side-by-side' '--override=*.mill:Scala' '--override=*.yuck:Emacs Lisp'\""
|
|
# Should NOT have difftool config when mode is "external"
|
|
assertFileNotRegex home-files/.config/git/config 'tool = "difftastic"'
|
|
assertFileNotRegex home-files/.config/git/config '\[difftool "difftastic"\]'
|
|
'';
|
|
}
|