difftastic: fix jujutsu integration

Don’t append `--color=always` and `--sort-paths` unconditionally, since
`difftastic` doesn’t like repeated arguments, and the user might have
already set them (via `config.programs.difftastic.options`).

To clarify, if `difft` gets called with any parameter repeated, it will
croak:

    difft --color=always --color=always
    error: the argument '--color <WHEN>' cannot be used multiple times

    Usage: difft [OPTIONS] OLD-PATH NEW-PATH

    For more information, try '--help'.

By patching `cfg.options` we ensure that the parameters are defined, and
have the required value, since the user might have selected differently
for their general setup (again, via `config.programs.difftastic.options`).
This commit is contained in:
pancho horrillo 2026-07-04 19:06:14 +02:00 committed by Austin Horstman
parent a7209b6794
commit bfb67e07a3

View file

@ -188,10 +188,14 @@ in
programs.jujutsu.settings.ui.diff-formatter = [
(lib.getExe cfg.package)
]
++ (lib.cli.toCommandLineGNU { } cfg.options)
++ (lib.cli.toCommandLineGNU { } (
cfg.options
// {
color = "always";
sort-paths = true;
}
))
++ [
"--color=always"
"--sort-paths"
"$left"
"$right"
];