]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: zsh: fix __gitcomp_direct()
authorFelipe Contreras <felipe.contreras@gmail.com>
Sun, 25 Oct 2020 03:13:15 +0000 (22:13 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Oct 2020 22:23:26 +0000 (15:23 -0700)
Many callers append a space suffix, but zsh automatically appends a
space, making the completion add two spaces, for example:

  git log ma<tab>

Will complete 'master  '.

Let's remove that extra space.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash
contrib/completion/git-completion.zsh

index 0a96ad87e7b6d8723175d3b97c18921ddc737d7b..ec7dd12a4155e876ae3fddb77038e2d7dee93de0 100644 (file)
@@ -3498,7 +3498,7 @@ if [[ -n ${ZSH_VERSION-} ]] &&
 
                local IFS=$'\n'
                compset -P '*[=:]'
-               compadd -Q -- ${=1} && _ret=0
+               compadd -Q -- ${${=1}% } && _ret=0
        }
 
        __gitcomp_nl ()
index ce47e86b60c04c7a398c20ded985f4187e5d3533..2cefae943ae56612eb6e1d502cc06997e6ce7b56 100644 (file)
@@ -74,7 +74,7 @@ __gitcomp_direct ()
 
        local IFS=$'\n'
        compset -P '*[=:]'
-       compadd -Q -- ${=1} && _ret=0
+       compadd -Q -- ${${=1}% } && _ret=0
 }
 
 __gitcomp_nl ()