mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-04 15:51:15 -03:00
completions/git: improve idempotency in case of double load
As mentioned in the previous few commits and in #11535, running "set fish_complete_path ..." and "complete -C 'git ...'" may result in "share/completions/git.fish" being loaded multiple times. This is usually fine because fish internally erases all cached completions whenever fish_complete_path changes. Unfortunately there is at least global variable that grows each time git.fish is sourced. This doesn't make a functional difference but it does slow down completions. Fix that by resetting the variable at load time.
This commit is contained in:
@@ -649,6 +649,7 @@ function __fish_git_aliased_command
|
||||
end
|
||||
end
|
||||
|
||||
set -g __fish_git_aliases
|
||||
git config -z --get-regexp 'alias\..*' | while read -lz alias cmdline
|
||||
set -l command (__fish_git_aliased_command $cmdline)
|
||||
string match -q --regex '\w+' -- $command; or continue
|
||||
|
||||
Reference in New Issue
Block a user