diff options
author | Matthieu Moy <Matthieu.Moy@imag.fr> | 2012-01-14 19:55:36 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-01-17 10:47:49 -0800 |
commit | ecc6601e4c47dd783cacf711faed4601de01a850 (patch) | |
tree | b2bf40d841c1d57aae0d7ccac1203aa15dbc0504 | |
parent | b63103e908af54e5e2eaa3faad350e4738ef0047 (diff) | |
download | git-mm/zsh-completion-regression-fix.tar.gz |
bash-completion: don't add quoted space for ZSH (fix regression)mm/zsh-completion-regression-fix
Commit a31e626 (completion: optimize refs completion) introduced a
regression for ZSH users: ref names were completed with a quoted trailing
space (i.e. "git checkout ma" completes to "git checkout master\ "). The
space is convenient for bash users since we use "-o nospace", but a
quoted space is worse than nothing. The absence of trailing space for ZSH
is a long-standing issue, that this patch is not fixing. We just fix the
regression by not appending a space when the shell is ZSH.
Original-patch-by: SZEDER Gábor <szeder@ira.uka.de>
Reported-by: Stefan Haller <lists@haller-berlin.de>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-x | contrib/completion/git-completion.bash | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index b0062bac22..488e1f4445 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -534,6 +534,12 @@ __gitcomp_nl () fi fi + # 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 + IFS=$s COMPREPLY=($(compgen -P "${2-}" -S "$suffix" -W "$1" -- "$cur_")) } |