* [PATCH] completion: fix issues with COMP_WORDBREAKS
@ 2012-04-15 21:17 Felipe Contreras
2012-04-16 0:38 ` Jonathan Nieder
0 siblings, 1 reply; 3+ messages in thread
From: Felipe Contreras @ 2012-04-15 21:17 UTC (permalink / raw)
To: git
Cc: Jonathan Nieder, SZEDER Gábor, Junio C Hamano, Thomas Rast,
Felipe Contreras
The situation regarding COMP_WORDBREAKS has changed through time, but
right now due to changes in bash 4 we are using _get_comp_words_by_ref
and there's no need to mess directly with COMP_WORDBREAKS any more.
In fact if COMP_WORDBREAKS doesn't contain a colon the completion gets
all messed up. For example:
git push origin master:<TAB>
git diff master:<TAB>
The "master:" prefix would be added again, unnecessarily.
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
contrib/completion/git-completion.bash | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9f56ec7..d9771f2 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -65,11 +65,6 @@ if [[ -n ${ZSH_VERSION-} ]]; then
autoload -U +X bashcompinit && bashcompinit
fi
-case "$COMP_WORDBREAKS" in
-*:*) : great ;;
-*) COMP_WORDBREAKS="$COMP_WORDBREAKS:"
-esac
-
# __gitdir accepts 0 or 1 arguments (i.e., location)
# returns location of .git repo
__gitdir ()
@@ -671,11 +666,6 @@ __git_complete_revlist_file ()
;;
esac
- case "$COMP_WORDBREAKS" in
- *:*) : great ;;
- *) pfx="$ref:$pfx" ;;
- esac
-
local IFS=$'\n'
COMPREPLY=($(compgen -P "$pfx" \
-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
@@ -758,10 +748,6 @@ __git_complete_remote_or_refspec ()
[ "$remote" = "." ] && remote=
case "$cur_" in
*:*)
- case "$COMP_WORDBREAKS" in
- *:*) : great ;;
- *) pfx="${cur_%%:*}:" ;;
- esac
cur_="${cur_#*:}"
lhs=0
;;
--
1.7.10
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] completion: fix issues with COMP_WORDBREAKS
2012-04-15 21:17 [PATCH] completion: fix issues with COMP_WORDBREAKS Felipe Contreras
@ 2012-04-16 0:38 ` Jonathan Nieder
2012-04-16 10:44 ` Felipe Contreras
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2012-04-16 0:38 UTC (permalink / raw)
To: Felipe Contreras; +Cc: git, SZEDER Gábor, Junio C Hamano, Thomas Rast
Felipe Contreras wrote:
> In fact if COMP_WORDBREAKS doesn't contain a colon the completion gets
> all messed up. For example:
>
> git push origin master:<TAB>
> git diff master:<TAB>
>
> The "master:" prefix would be added again, unnecessarily.
Thanks. Yeah, that sounds broken.
Unfortunately the patch introduces a regression: if after loading the
completion script I set COMP_WORDBREAKS not to contain a colon, then
with the current completion script
git show HEAD:Docu<TAB>
completes fine, but with the patched completion script it seems to
get confused and strips off the HEAD.
Ideas?
Jonathan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] completion: fix issues with COMP_WORDBREAKS
2012-04-16 0:38 ` Jonathan Nieder
@ 2012-04-16 10:44 ` Felipe Contreras
0 siblings, 0 replies; 3+ messages in thread
From: Felipe Contreras @ 2012-04-16 10:44 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git, SZEDER Gábor, Junio C Hamano, Thomas Rast
On Mon, Apr 16, 2012 at 3:38 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Felipe Contreras wrote:
>
>> In fact if COMP_WORDBREAKS doesn't contain a colon the completion gets
>> all messed up. For example:
>>
>> git push origin master:<TAB>
>> git diff master:<TAB>
>>
>> The "master:" prefix would be added again, unnecessarily.
>
> Thanks. Yeah, that sounds broken.
>
> Unfortunately the patch introduces a regression: if after loading the
> completion script I set COMP_WORDBREAKS not to contain a colon, then
> with the current completion script
>
> git show HEAD:Docu<TAB>
>
> completes fine, but with the patched completion script it seems to
> get confused and strips off the HEAD.
I don't understand, I tested this and it was working fine, but not any more =/
Maybe I was testing on zsh.
I guess this should be dropped then.
Cheers.
--
Felipe Contreras
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-04-16 10:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-15 21:17 [PATCH] completion: fix issues with COMP_WORDBREAKS Felipe Contreras
2012-04-16 0:38 ` Jonathan Nieder
2012-04-16 10:44 ` Felipe Contreras
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.