From 585dc16a661dfb5831a8cb0679e016a69b9ba399 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Tue, 15 Jun 2021 03:16:59 +0200 Subject: [PATCH] completions/git: complete normal files on "git checkout -- " This can give false positives but only if used on directories that mix tracked and untracked files. The performance is better than listing all tracked files, and in any case we're pretty far from a correct solution that knows the target Git commit, so this seems like good compromise. --- share/completions/git.fish | 1 + 1 file changed, 1 insertion(+) diff --git a/share/completions/git.fish b/share/completions/git.fish index 703999d4a..792245090 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -969,6 +969,7 @@ complete -f -c git -n '__fish_git_using_command add' -a '(__fish_git_files modif # TODO options ### checkout +complete -F -c git -n '__fish_git_using_command checkout; and contains -- -- (commandline -opc)' complete -f -c git -n __fish_git_needs_command -a checkout -d 'Checkout and switch to a branch' complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_tags)' -d Tag complete -k -f -c git -n '__fish_git_using_command checkout; and not contains -- -- (commandline -opc)' -a '(__fish_git_heads)' -d Head