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

Re: [completion] Request: Include remote heads as push targets

From
Peter van der Does <peter@avirtualhome.com>
Date
Oct 22, 2010, 01:08 UTC
Message-ID
<20101021210842.6545a661@montecarlo.grandprix.int>
In-Reply-To
<20101021191045.GC11759@burratino>

On Thu, 21 Oct 2010 14:10:45 -0500 Jonathan Nieder <jrnieder@gmail.com> wrote:

Show 11 quoted lines
> Marc Branchaud wrote:
> 
> > Hmmm, perhaps this is really a bug.
> 
> Compare:
> http://thread.gmane.org/gmane.comp.version-control.git/159448
> 
> Gábor, would it be possible to summarize the problem with a simple
> test case that could be used to get help on this from the (upstream
> or distro-specific) bash maintainers?
> --

In the case of Marc's problem, it would be helpful to see what the result is in Bash 3.

As for Gábor find: The problem resides in Bash 4. Bash 4 has a new set of characters that are defined as break up characters Thanks to Brain Gernhard: From the Bash 4.0 changelog: i. The programmable completion code now uses the same set of characters as readline when breaking the command line into a list of words.

As far as I can tell, from the Bash 4.0 source, these are the characters: " \t\n\"'@><=;|&(:" In the completion script checks are performed if an option is given. The test includes the equal sign but the array with words does not the equal sign. Example to clarify:

local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)"
case "$cur" in
  --whitespace=*)
      __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}"
      return
      ;;

If you execute: $ git am --whitespace=<tab><tab>

The variable cur holds the equal sign and so the __gitcomp function is never executed.

I have patched the entire completion script which fixes this, and some other issues related to the Bash 4 change, but it will only work in Bash 4.0 and I am sure it will dramatically fail in Bash 3.0. I don't have the knowledge to determine which Bash version is running in the git.spec.in file. If you could that would be a way to either install the new version or the old one.

-- 
Peter van der Does

GPG key: E77E8E98

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

WordPress Plugin Developer
Blog: http://blog.avirtualhome.com
Forums: http://forums.avirtualhome.com
Twitter: @avhsoftware
Previous: Jonathan NiederNext: Kevin Ballard
Message 4 of 10 in “[completion] Request: Include remote heads as push targets”
  1. Marc BranchaudOct 21, 2010
  2. Marc BranchaudOct 21, 2010
  3. Jonathan NiederOct 21, 2010
  4. Peter van der DoesOct 22, 2010
  5. Kevin BallardOct 22, 2010
  6. Marc BranchaudOct 22, 2010
  7. SZEDER GáborOct 23, 2010
  8. Peter van der DoesOct 24, 2010
  9. SZEDER GáborOct 24, 2010
  10. Peter van der DoesOct 24, 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.