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

Re: [PATCH v2/RFC] Make git-completion Bash 4 compatible.

From
Peter van der Does <peter@avirtualhome.com>
Date
Oct 28, 2010, 00:52 UTC
Message-ID
<20101027205217.3f28b9d1@MonteCarlo>
In-Reply-To
<20101027225318.GB1877@neumann>

On Thu, 28 Oct 2010 00:53:18 +0200 SZEDER Gábor <szeder@ira.uka.de> wrote:

Show 39 quoted lines
> Hi Jonathan,
> 
> 
> On Wed, Oct 27, 2010 at 12:31:32PM -0500, Jonathan Nieder wrote:
> > Could some zsh user perhaps test that the new zsh support is not
> > broken?
> 
> I'm afraid it is.
> 
> The commit message of 06f44c3 (completion: make compatible with zsh,
> 2010-09-06) says:
> 
>     ${var:2}
>         Zsh does not implement ${var:2} to skip the first 2
> characters, but ${var#??} works in both shells to replace the first 2
> characters with nothing.  Thanks to Jonathan Nieder for the
> suggestion.
> 
>     for (( n=1; "$n" ... ))
>         Zsh does not allow "$var" in arithmetic loops.  Instead,
> pre-compute the endpoint and use the variables without $'s or quotes.
> 
> However, the functions taken over from the bash-completion code
> contain constructs like:
> 
>     ${cur:0:$index}
>     # ok, this is not exactly the same as ${var:2}, so it might even
>     # work...
> 
> and
> 
>     for (( i=0, j=0; i < ${#COMP_WORDS[@]}; i++, j++)); do
> 
> But I haven't actually tried it.
> 
> 
> Best,
> Gábor
> 

On the zsh change, I replied to the email "What's cooking in git.git (Oct 2010, #02; Tue, 26)"

Show 5 quoted lines
> With the patch "Make git-completion Bash 4 compatible" in mind, it
> might be useful to start looking into a different way to distribute
> the completion script to accommodate different shells. Adding
> compatibility for each shell into one script can get nasty. We could
> have a different completion script for each shell.

The bash completion script could still be included with the core, but we can offer different versions for different shells.

-- 
Peter van der Does

GPG key: E77E8E98

IRC: Ganseki on irc.freenode.net
Twitter: @petervanderdoes
Previous: SZEDER GáborNext: Jonathan Nieder
Message 5 of 11 in “Make git-completion Bash 4 compatible.”
  1. Make git-completion Bash 4 compatible.Peter van der Does, Oct 27, 2010
  2. Brian GernhardtOct 27, 2010
  3. Jonathan NiederOct 27, 2010
  4. SZEDER GáborOct 27, 2010
  5. Peter van der DoesOct 28, 2010
  6. Jonathan NiederOct 28, 2010
  7. Peter van der DoesOct 28, 2010
  8. Jakub NarebskiOct 28, 2010
  9. Peter van der DoesOct 28, 2010
  10. SZEDER GáborOct 27, 2010
  11. Jonathan NiederOct 28, 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.