Re: [PATCH v4 0/2] Make git-completion Bash 4 compatible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2 Dec 2010 03:16:24 -0600
Jonathan Nieder <jrnieder@xxxxxxxxx> wrote:

> Hi again,
> 
> Peter van der Does wrote:
> 
> > Make git-completion Bash 4 compatible.
> 
> Thanks again for this work and sorry for all the fuss.
> 
> > Peter van der Does (2):
> >   Introduce functions from bash-completion project.
> 
> This patch introduces a minor regression in that it breaks the
> (already somewhat incomplete) zsh support.  Should be fixable by
> falling back to using COMP_WORDS on zsh.
> 
> >   Use the new functions to get the current cword.
> 
> This one introduces some subtle differences between commands and imho
> does more than it set out to do, by differentiating word splitting
> behavior between commands.  bash 3 was not splitting COMP_WORDS at
> equal signs or colons, ever.  Maybe we can start with that and then
> make refinements on top later.
> 
> While trying that out, I had an idea.  The patch depends on
> understanding the bash-completion library function introduced by patch
> 1, but I think we can avoid that by rearranging the patch series like
> this:
> 
>  1. If _get_comp_words_by_ref is already defined, use it to fetch
>     completion words.  Otherwise, just use COMP_WORDS (using a stub
>     _get_comp_words_by_ref), maintaining the current behavior.
>     [shown below]
> 
>  2. Import the definition of _get_comp_words_by_ref from the
>     bash-completion lib and use it if ZSH_VERSION is unset.
> 
>  3. Further refinements, if needed.
> 
> What do you think?
> 

I like the idea and we should go with this solution.

If by importing you mean using :
[CODE]. /git_bash_completion-functions[/CODE] in the
contrib/completion/git-completion.bash script, which would be the best
solution imho. The question is where to place that the function file.

This would also means changing the documentation inside the
git-completion.bash script, currently the instructions are:
[QUOTE]
# To use these routines:
#
#    1) Copy this file to somewhere (e.g. ~/.git-completion.sh).
#    2) Added the following line to your .bashrc:
#        source ~/.git-completion.sh
[/QUOTE]

It would have to include copying the functions file somewhere as well.

Or we could use the method used now and include the functions in the
git-completion.bash script.

I'll be waiting for further feedback from Gábor, as he mentioned on the
list of he had some little changes to fix some minor nits and bugs
before completely implementing this solution.

-- 
Peter van der Does

GPG key: E77E8E98

IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]