From 4b5650ee4fa778ae88fcfddbe680df29cd91783f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 28 May 2025 13:31:24 +0200 Subject: [PATCH] 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. --- share/completions/git.fish | 1 + 1 file changed, 1 insertion(+) diff --git a/share/completions/git.fish b/share/completions/git.fish index 05f1b5954..ed3ec618f 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -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