From: Mark Lodato <lodato@google.com>
To: git@vger.kernel.org
Cc: Mark Lodato <lodato@google.com>,
Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH] git-completion.zsh: do not clobber complete()
Date: Fri, 14 Feb 2014 16:24:00 -0500 [thread overview]
Message-ID: <1392413040-28436-1-git-send-email-lodato@google.com> (raw)
Previously, git-completion.zsh redefined complete() to make __git_complete()
a no-op. This broke zsh's built-in bash completion compatibility layer
(bashcompinit), which defines its own complete().
Sadly, since there is no way in zsh to restore the original defintion of
complete() after bash-completion.bash is sourced, we must pass in a flag to
git-completion.bash to change its behavior.
Signed-off-by: Mark Lodato <lodato@google.com>
---
contrib/completion/git-completion.bash | 1 +
contrib/completion/git-completion.zsh | 8 +-------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9525343..36aa8bb 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2650,6 +2650,7 @@ __git_func_wrap ()
# This is NOT a public function; use at your own risk.
__git_complete ()
{
+ [[ -n $GIT_DO_NOT_CALL_COMPLETE ]] && return
local wrapper="__git_wrap${2}"
eval "$wrapper () { __git_func_wrap $2 ; }"
complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 6b77968..9f68d63 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -16,12 +16,6 @@
#
# fpath=(~/.zsh $fpath)
-complete ()
-{
- # do nothing
- return 0
-}
-
zstyle -T ':completion:*:*:git:*' tag-order && \
zstyle ':completion:*:*:git:*' tag-order 'common-commands'
@@ -39,7 +33,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break
done
fi
-ZSH_VERSION='' . "$script"
+GIT_DO_NOT_CALL_COMPLETE=1 ZSH_VERSION='' . "$script"
__gitcomp ()
{
--
1.9.0.rc1.175.g0b1dcb5
next reply other threads:[~2014-02-14 21:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 21:24 Mark Lodato [this message]
2014-04-30 5:58 ` [PATCH] git-completion.zsh: do not clobber complete() Felipe Contreras
2014-04-30 10:02 ` Felipe Contreras
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=1392413040-28436-1-git-send-email-lodato@google.com \
--to=lodato@google.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
/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).