diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1689f99539..d9a93ea418 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -509,6 +509,13 @@ __gitcomp () __gitcomp_nl () { local IFS=$'\n' + + # ZSH would quote the trailing space added with -S. bash users + # will appreciate the extra space to compensate the use of -o nospace. + if [ -n "${ZSH_VERSION-}" ] && [ "$suffix" = " " ]; then + suffix="" + fi + COMPREPLY=($(compgen -P "${2-}" -S "${4- }" -W "$1" -- "${3-$cur}")) }