* [PATCH 0/6] completion: fixes
@ 2014-04-30 11:07 Felipe Contreras
2014-04-30 11:07 ` [PATCH 1/6] completion: bash: remove old wrappers Felipe Contreras
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
A bunch of cleanups and fixes.
Felipe Contreras (6):
completion: bash: remove old wrappers
completion: bash: remove zsh wrapper
completion: zsh: don't hide ourselves
completion: remove zsh hack
completion: zsh: trivial cleanups
completion: bash: cleanup cygwin check
contrib/completion/git-completion.bash | 80 +---------------------------------
contrib/completion/git-completion.zsh | 18 ++------
2 files changed, 6 insertions(+), 92 deletions(-)
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/6] completion: bash: remove old wrappers
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
2014-04-30 11:07 ` [PATCH 2/6] completion: bash: remove zsh wrapper Felipe Contreras
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.bash | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9525343..6e331d2 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2656,18 +2656,6 @@ __git_complete ()
|| complete -o default -o nospace -F $wrapper $1
}
-# wrapper for backwards compatibility
-_git ()
-{
- __git_wrap__git_main
-}
-
-# wrapper for backwards compatibility
-_gitk ()
-{
- __git_wrap__gitk_main
-}
-
__git_complete git __git_main
__git_complete gitk __gitk_main
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/6] completion: bash: remove zsh wrapper
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
2014-04-30 11:07 ` [PATCH 1/6] completion: bash: remove old wrappers Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
2014-04-30 11:07 ` [PATCH 3/6] completion: zsh: don't hide ourselves Felipe Contreras
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
It has been deprecated for one year and a half. It's time to move on.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.bash | 64 ----------------------------------
1 file changed, 64 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 6e331d2..be0ea36 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2574,70 +2574,6 @@ __gitk_main ()
__git_complete_revlist
}
-if [[ -n ${ZSH_VERSION-} ]]; then
- echo "WARNING: this script is deprecated, please see git-completion.zsh" 1>&2
-
- autoload -U +X compinit && compinit
-
- __gitcomp ()
- {
- emulate -L zsh
-
- local cur_="${3-$cur}"
-
- case "$cur_" in
- --*=)
- ;;
- *)
- local c IFS=$' \t\n'
- local -a array
- for c in ${=1}; do
- c="$c${4-}"
- case $c in
- --*=*|*.) ;;
- *) c="$c " ;;
- esac
- array[${#array[@]}+1]="$c"
- done
- compset -P '*[=:]'
- compadd -Q -S '' -p "${2-}" -a -- array && _ret=0
- ;;
- esac
- }
-
- __gitcomp_nl ()
- {
- emulate -L zsh
-
- local IFS=$'\n'
- compset -P '*[=:]'
- compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
- }
-
- __gitcomp_file ()
- {
- emulate -L zsh
-
- local IFS=$'\n'
- compset -P '*[=:]'
- compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
- }
-
- _git ()
- {
- local _ret=1 cur cword prev
- cur=${words[CURRENT]}
- prev=${words[CURRENT-1]}
- let cword=CURRENT-1
- emulate ksh -c __${service}_main
- let _ret && _default && _ret=0
- return _ret
- }
-
- compdef _git git gitk
- return
-fi
-
__git_func_wrap ()
{
local cur words cword prev
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/6] completion: zsh: don't hide ourselves
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
2014-04-30 11:07 ` [PATCH 1/6] completion: bash: remove old wrappers Felipe Contreras
2014-04-30 11:07 ` [PATCH 2/6] completion: bash: remove zsh wrapper Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
2014-04-30 11:07 ` [PATCH 4/6] completion: remove zsh hack Felipe Contreras
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
There's no need to hide the fact that we are on zsh any more.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.zsh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 6b77968..6432b3f 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -39,7 +39,7 @@ if [ -z "$script" ]; then
test -f $e && script="$e" && break
done
fi
-ZSH_VERSION='' . "$script"
+. "$script"
__gitcomp ()
{
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/6] completion: remove zsh hack
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
` (2 preceding siblings ...)
2014-04-30 11:07 ` [PATCH 3/6] completion: zsh: don't hide ourselves Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
2014-04-30 11:07 ` [PATCH 5/6] completion: zsh: trivial cleanups Felipe Contreras
2014-04-30 11:07 ` [PATCH 6/6] completion: bash: cleanup cygwin check Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
We don't want to override the 'complete()' function in zsh, which can be
used by bashcomp.
Reported-by: Mark Lodato <lodato@google.com>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.bash | 1 +
contrib/completion/git-completion.zsh | 6 ------
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index be0ea36..f1ce962 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2586,6 +2586,7 @@ __git_func_wrap ()
# This is NOT a public function; use at your own risk.
__git_complete ()
{
+ test -n "$ZSH_VERSION" && 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 6432b3f..e71896a 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'
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/6] completion: zsh: trivial cleanups
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
` (3 preceding siblings ...)
2014-04-30 11:07 ` [PATCH 4/6] completion: remove zsh hack Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
2014-04-30 11:07 ` [PATCH 6/6] completion: bash: cleanup cygwin check Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
We don't need to override IFS, zsh has a native way of splitting by new
lines: the expansion flag (f).
Also, we don't need to split files by ':' or '='; that's only for words.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.zsh | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index e71896a..f72f71c 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -65,26 +65,22 @@ __gitcomp_nl ()
{
emulate -L zsh
- local IFS=$'\n'
compset -P '*[=:]'
- compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
+ compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
}
__gitcomp_nl_append ()
{
emulate -L zsh
- local IFS=$'\n'
- compadd -Q -S "${4- }" -p "${2-}" -- ${=1} && _ret=0
+ compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
}
__gitcomp_file ()
{
emulate -L zsh
- local IFS=$'\n'
- compset -P '*[=:]'
- compadd -Q -p "${2-}" -f -- ${=1} && _ret=0
+ compadd -Q -p "${2-}" -f -- ${(f)1} && _ret=0
}
__git_zsh_bash_func ()
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 6/6] completion: bash: cleanup cygwin check
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
` (4 preceding siblings ...)
2014-04-30 11:07 ` [PATCH 5/6] completion: zsh: trivial cleanups Felipe Contreras
@ 2014-04-30 11:07 ` Felipe Contreras
5 siblings, 0 replies; 7+ messages in thread
From: Felipe Contreras @ 2014-04-30 11:07 UTC (permalink / raw)
To: git; +Cc: Felipe Contreras
Avoid Yoda conditions, use test, and cleaner statement.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.bash | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f1ce962..34edef9 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -2600,6 +2600,5 @@ __git_complete gitk __gitk_main
# when the user has tab-completed the executable name and consequently
# included the '.exe' suffix.
#
-if [ Cygwin = "$(uname -o 2>/dev/null)" ]; then
+test "$(uname -o 2>/dev/null)" = "Cygwin" &&
__git_complete git.exe __git_main
-fi
--
1.9.2+fc1.11.g71fb719
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-04-30 11:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-30 11:07 [PATCH 0/6] completion: fixes Felipe Contreras
2014-04-30 11:07 ` [PATCH 1/6] completion: bash: remove old wrappers Felipe Contreras
2014-04-30 11:07 ` [PATCH 2/6] completion: bash: remove zsh wrapper Felipe Contreras
2014-04-30 11:07 ` [PATCH 3/6] completion: zsh: don't hide ourselves Felipe Contreras
2014-04-30 11:07 ` [PATCH 4/6] completion: remove zsh hack Felipe Contreras
2014-04-30 11:07 ` [PATCH 5/6] completion: zsh: trivial cleanups Felipe Contreras
2014-04-30 11:07 ` [PATCH 6/6] completion: bash: cleanup cygwin check Felipe Contreras
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).