Files
home-manager/tests/modules/programs/diff-highlight/diff-highlight-migration.nix
Ihar Hrachyshka 3c7524c683 treewide: set git pager for specific commands, not for core.pager
Setting `core.pager` may result in issues like swallowed `git grep` results. 
To avoid this, apply pagers to specific commands where we expect `diff`-ish output only. 
Use a common helper to set pager for all modules that configure it.
2026-04-14 11:31:44 -05:00

36 lines
1.4 KiB
Nix

{
lib,
options,
...
}:
{
programs.git = {
enable = true;
diff-highlight = {
enable = true;
pagerOpts = [
"--tabs=4"
"-RFX"
];
};
};
test.asserts.warnings.expected = [
"The option `programs.git.diff-highlight.pagerOpts' defined in ${lib.showFiles options.programs.git.diff-highlight.pagerOpts.files} has been renamed to `programs.diff-highlight.pagerOpts'."
"The option `programs.git.diff-highlight.enable' defined in ${lib.showFiles options.programs.git.diff-highlight.enable.files} has been renamed to `programs.diff-highlight.enable'."
"`programs.diff-highlight.enableGitIntegration` automatic enablement is deprecated. Please explicitly set `programs.diff-highlight.enableGitIntegration = true`."
];
nmt.script = ''
# Git config should contain diff-highlight configuration (backward compatibility)
assertFileExists home-files/.config/git/config
assertFileContains home-files/.config/git/config '[pager]'
assertFileRegex home-files/.config/git/config 'diff = .*/diff-highlight.*less'
assertFileRegex home-files/.config/git/config 'log = .*/diff-highlight.*less'
assertFileRegex home-files/.config/git/config 'show = .*/diff-highlight.*less'
assertFileContains home-files/.config/git/config '[interactive]'
assertFileRegex home-files/.config/git/config 'diffFilter = .*/diff-highlight'
'';
}