git: complete git diff src/ to show modified files before unmodified ones

This has the side effect of changing the order of completions for a bare `git
diff` to show modified files before revisions; previously they came at the very
end after all revisions, stashes, local branches, remote branches, and tags.
That seems sensible to me?

As I understand the completions file, it seems to me that the intention was for
`git diff src/` to only show modified files to begin with ­ it
previously/currently shows them all, so we might want to add a `-n 'not ...'`
condition for `git diff` to prevent that.
This commit is contained in:
Mahmoud Al-Qudsi 2024-11-10 12:49:50 -06:00
parent dff454b1c7
commit f0a3a5708f

View File

@ -1440,7 +1440,7 @@ complete -c git -n '__fish_git_using_command diff' -s 1 -l base -d 'Compare the
complete -c git -n '__fish_git_using_command diff' -s 2 -l ours -d 'Compare the working tree with the "our branch"'
complete -c git -n '__fish_git_using_command diff' -s 3 -l theirs -d 'Compare the working tree with the "their branch"'
complete -c git -n '__fish_git_using_command diff' -s 0 -d 'Omit diff output for unmerged entries and just show "Unmerged"'
complete -c git -n '__fish_git_using_command diff' -n 'not __fish_git_contains_opt cached staged' -a '(
complete -c git -n '__fish_git_using_command diff' -k -n 'not __fish_git_contains_opt cached staged' -a '(
set -l kinds modified
contains -- -- (commandline -xpc) && set -a kinds deleted modified-staged-deleted
__fish_git_files $kinds