From f0a3a5708f00674bf4633e290c1e6fc233ffd442 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sun, 10 Nov 2024 12:49:50 -0600 Subject: [PATCH] git: complete `git diff src/` to show modified files before unmodified ones MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index ad9bb417f..3bb459e5f 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -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