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

Re: [PATCH] bash completion: Fix the . -> .. revision range completion

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 14, 2008, 05:57 UTC
Message-ID
<20080714055712.GB15793@spearce.org>
In-Reply-To
<alpine.LFD.1.10.0807132210430.3305@woody.linux-foundation.org>
Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 13 quoted lines
> On Mon, 14 Jul 2008, Shawn O. Pearce wrote:
> > > 
> > > Does it fix this one too:
> > > 
> > > 	git show origin/pu:Makef<tab>
> > > 
> > > which totally screws up and becomes
> > > 
> > > 	git show Makefile
> > > 
> > > dropping the version specifier?
> 
> What version of bash do you have?
GNU bash, version 3.2.17(1)-release (i386-apple-darwin9.0)
> It definitely doesn't work for me with 
> 
> 	GNU bash, version 3.2.33(1)-release (x86_64-redhat-linux-gnu)
So between .17 and .33 they changed something.
 
> Something like this seems to be totally missing, and definitely required. 
> How can you say that it works for you? I don't see how that is possible 
> even in theory? Did you actually test it?
Yes, of course dammit, I did test it before writing an email that
said "I tested this ...".
 
Show 13 quoted lines
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index 27332ed..0a87337 100755
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -290,7 +290,7 @@ __git_complete_file ()
>  			ls="$ref"
>  			;;
>  	    esac
> -		COMPREPLY=($(compgen -P "$pfx" \
> +		COMPREPLY=($(compgen -P "$ref:$pfx" \
>  			-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
>  				| sed '/^100... blob /s,^.*	,,
>  				       /^040000 tree /{

In bash 3.2.17 your change above causes completion to include the ref name _twice_:

	git show jc/html:in<tab>
	git show jc/html:jc/html:index.html

This is not good news because it means we need to perform a version test to identify the correct behavior we need for this shell, and we also have to figure out what version of 3.2.X this changed in. *sigh*

-- 
Shawn.
Previous: Linus TorvaldsNext: Shawn O. Pearce
Message 10 of 22 in “bash completion: Fix the . -> .. revision range completion”
  1. bash completion: Fix the . -> .. revision range completionPetr Baudis, Jul 13, 2008
  2. Jakub NarebskiJul 13, 2008
  3. Junio C HamanoJul 13, 2008
  4. Shawn O. PearceJul 13, 2008
  5. Petr BaudisJul 13, 2008
  6. Junio C HamanoJul 13, 2008
  7. Linus TorvaldsJul 13, 2008
  8. Shawn O. PearceJul 14, 2008
  9. Linus TorvaldsJul 14, 2008
  10. Shawn O. PearceJul 14, 2008
  11. Shawn O. PearceJul 14, 2008
  12. Björn SteinbrinkJul 14, 2008
  13. Björn SteinbrinkJul 14, 2008
  14. Andreas EricssonJul 14, 2008
  15. Linus TorvaldsJul 14, 2008
  16. Linus TorvaldsJul 14, 2008
  17. Shawn O. PearceJul 15, 2008
  18. Andreas EricssonJul 15, 2008
  19. Andreas EricssonJul 15, 2008
  20. Andreas EricssonJul 15, 2008
  21. Shawn O. PearceJul 15, 2008
  22. Andreas EricssonJul 16, 2008

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.