From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH] bash-completion: don't add quoted space for ZSH (fix regression)
Date: Sat, 14 Jan 2012 19:55:36 +0100 [thread overview]
Message-ID: <1326567336-2173-1-git-send-email-Matthieu.Moy@imag.fr> (raw)
In-Reply-To: <20120114152030.GX30469@goldbirke>
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>
---
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 b0062ba..488e1f4 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_"))
}
--
1.7.9.rc0.25.gb9a1f.dirty
next prev parent reply other threads:[~2012-01-14 18:56 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-12 11:52 Zsh completion regression Stefan Haller
2012-01-12 14:56 ` Matthieu Moy
2012-01-14 13:23 ` SZEDER Gábor
2012-01-14 14:32 ` Matthieu Moy
2012-01-14 15:20 ` SZEDER Gábor
2012-01-14 18:55 ` Matthieu Moy [this message]
2012-01-15 2:29 ` [PATCH] bash-completion: don't add quoted space for ZSH (fix regression) Junio C Hamano
2012-01-16 11:49 ` Matthieu Moy
2012-01-16 22:47 ` Junio C Hamano
2012-01-17 12:21 ` Matthieu Moy
2012-01-17 18:46 ` Junio C Hamano
2012-01-17 19:18 ` Felipe Contreras
2012-01-17 20:03 ` Felipe Contreras
2012-01-17 20:11 ` Junio C Hamano
2012-01-17 23:04 ` Felipe Contreras
2012-01-17 23:42 ` Junio C Hamano
2012-01-18 8:16 ` Matthieu Moy
2012-01-25 1:39 ` Felipe Contreras
2012-01-25 4:06 ` Junio C Hamano
2012-01-14 21:36 ` Zsh completion regression Stefan Haller
2012-01-14 21:36 ` Stefan Haller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326567336-2173-1-git-send-email-Matthieu.Moy@imag.fr \
--to=matthieu.moy@imag.fr \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).