completions/git: restore forward-compatibility by using "complete -c"

After a fish installation is upgraded to 3.2.0, active shells could
throw an error attempting to load Git completions. It's just a
transient error but also easily avoidable by using the old style.

See #7822
This commit is contained in:
Johannes Altmanninger 2021-03-15 22:27:04 +01:00
parent f95f12f5e7
commit 582675c96a
2 changed files with 4 additions and 4 deletions

View file

@ -1923,8 +1923,8 @@ for file in $PATH/git-*
and continue
complete -C "git-$subcommand " >/dev/null
if [ (complete git-$subcommand | count) -gt 0 ]
complete git -f -n "__fish_git_using_command $subcommand" -a "(__fish_git_complete_custom_command $subcommand)"
if [ (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
set -a __fish_git_custom_commands_completion $subcommand
end

View file

@ -1,2 +1,2 @@
complete source -k -xa '(__fish_complete_suffix .fish)'
complete source -s h -l help -d 'Display help and exit'
complete -c source -k -xa '(__fish_complete_suffix .fish)'
complete -c source -s h -l help -d 'Display help and exit'