From 7c8b309d79b17c05ea0547ff9257a4b0ab52c457 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Tue, 18 Apr 2023 20:40:14 +0200 Subject: [PATCH] completions/git: Escape custom command names This can be triggered by having a custom git command in e.g. `/mnt/c/Program Files (x86)/foo/`. Fixes #9738 (cherry picked from commit db5c9badad6162e79dbf68ec83275de6df061e1d) --- share/completions/git.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/completions/git.fish b/share/completions/git.fish index 900081d8d..756e09ed8 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2392,7 +2392,7 @@ for file in (path filter -xZ $PATH/git-* | path basename) and continue # Running `git foo` ends up running `git-foo`, so we need to ignore the `git-` here. - set -l cmd (string replace -r '^git-' '' -- $file) + set -l cmd (string replace -r '^git-' '' -- $file | string escape) complete -c git -f -n "__fish_git_using_command $cmd" -a "(__fish_git_complete_custom_command $cmd)" set -a __fish_git_custom_commands_completion $file end