completions/git: speed up loading git.fish when "git-foo" completions already exists

git.fish loads git-foo.fish completions.
As reported in #8831, this can be slow when the user has run something like

    complete git-foo -w 'git diff'

because git.fish runs 'complete -C "git-autofixup "' at load time.
Commit 09161761c (Complete custom "git-foo" commands from "git foo",
2021-01-24) did that to avoid adding filename completions for "git foo".
Drop that check.

This means that users who don't want filename completion for "git foo",
need to define at least one custom completion for "git-foo", like

    complete git-foo -f
This commit is contained in:
Johannes Altmanninger 2022-04-02 12:24:38 +02:00
parent 002c2b6170
commit ff72e3f154

View file

@ -2185,9 +2185,6 @@ for file in $PATH/git-*
contains -- $subcommand $__fish_git_custom_commands_completion
and continue
complete -C "git-$subcommand " >/dev/null
if test (complete -c git-$subcommand | count) -gt 0
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
end
complete -c git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
set -a __fish_git_custom_commands_completion $subcommand
end