git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Peter van der Does <peter@avirtualhome.com>
Date
Dec 2, 2010, 14:16 UTC
Message-ID
<20101202091613.6ac8f816@MonteCarlo.grandprix.int>
In-Reply-To
<20101202091624.GB1771@burratino>

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

Show 40 quoted lines
> 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
Previous: Jonathan NiederNext: Jonathan Nieder
Message 9 of 22 in “*** SUBJECT HERE ***”
  1. 0/2 *** SUBJECT HERE ***Peter van der Does, Dec 1, 2010
  2. 1/2 Introduce functions from bash-completion project.Peter van der Does, Dec 1, 2010
  3. 2/2 Use the new functions to get the current cword.Peter van der Does, Dec 1, 2010
  4. Jonathan NiederDec 2, 2010
  5. SZEDER GáborDec 2, 2010
  6. Jonathan NiederDec 1, 2010
  7. SZEDER GáborDec 2, 2010
  8. Jonathan NiederDec 2, 2010
  9. Peter van der DoesDec 2, 2010
  10. 2/1 bash: eliminate dependency on bash_completion libJonathan Nieder, Dec 2, 2010
  11. SZEDER GáborDec 2, 2010
  12. Jonathan NiederDec 3, 2010
  13. Stephen BoydDec 3, 2010
  14. SZEDER GáborDec 7, 2010
  15. Jonathan NiederDec 7, 2010
  16. SZEDER GáborDec 7, 2010
  17. Jonathan NiederDec 7, 2010
  18. Junio C HamanoDec 7, 2010
  19. 0/3 Make git-completion Bash 4 compatibleJonathan Nieder, Dec 15, 2010
  20. 1/3 bash: get --pretty=m<tab> completion to work with bash v4Jonathan Nieder, Dec 15, 2010
  21. 2/3 bash: simple reimplementation of _get_comp_words_by_refJonathan Nieder, Dec 15, 2010
  22. 3/3 Merge branch 'master' (early part) into pd/bash-4-completionJonathan Nieder, Dec 15, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.