diff --git a/share/completions/git.fish b/share/completions/git.fish index 592d358b2..89057e342 100644 --- a/share/completions/git.fish +++ b/share/completions/git.fish @@ -2571,9 +2571,9 @@ function __fish_git_complete_custom_command -a subcommand set -e cmd[1] # Drop "git". set -l subcommand_args if argparse -s (__fish_git_global_optspecs) -- $cmd - set subcommand_args $argv[2..] # Drop the subcommand. + set subcommand_args (string escape -- $argv[2..]) # Drop the subcommand. end - complete -C "git-$subcommand $(string escape -- $subcommand_args) "(commandline -ct) + complete -C "git-$subcommand $subcommand_args "(commandline -ct) end # source git-* commands' autocompletion file if exists diff --git a/tests/checks/git.fish b/tests/checks/git.fish index 5e3d71cf3..4af64cd4f 100644 --- a/tests/checks/git.fish +++ b/tests/checks/git.fish @@ -51,6 +51,10 @@ complete -C'git frobnicate --onto ' #CHECK: onto1 #CHECK: onto2 +complete -C'git frobnicate graft --onto ' +#CHECK: onto1 +#CHECK: onto2 + complete -C'git ' | grep '^add'\t # (note: actual tab character in the check here) #CHECK: add Add file contents to the staging area