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

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

From
Andreas Ericsson <ae@op5.se>
Date
Jul 16, 2008, 07:20 UTC
Message-ID
<487DA138.8040004@op5.se>
In-Reply-To
<20080715233851.GA23672@spearce.org>
Shawn O. Pearce wrote:
Show 33 quoted lines
> Andreas Ericsson <ae@op5.se> wrote:
>> I beat you to it ;-) This works just fine for me regardless of whether
>> or not I have a colon in COMP_WORDBREAKS.
> ...
>> Subject: git-completion.bash: Handle "rev:path" completion properly
> ...
>> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
>> index d268e6f..e138022 100755
>> --- a/contrib/completion/git-completion.bash
>> +++ b/contrib/completion/git-completion.bash
>> @@ -293,7 +293,11 @@ __git_complete_file ()
>> 		*)
>> 			ls="$ref"
>> 			;;
>> -	    esac
>> +		esac
>> +		# When completing something like 'rev:path', bash behaves
>> +		# differently whether or not COMP_WORDBREAKS contains a
>> +		# colon or not. This lets it handle both cases
>> +		test "${COMP_WORDBREAKS//:}" = "$COMP_WORDBREAKS" && pfx="$ref:$pfx"
>> 		COMPREPLY=($(compgen -P "$pfx" \
>> 			-W "$(git --git-dir="$(__gitdir)" ls-tree "$ls" \
>> 				| sed '/^100... blob /s,^.*	,,
> 
> Yea, I did more or less the same thing in my patch, but I also
> handled this fix in git-fetch and git-push.  The : is also used
> there in a refspec and we support completion the right side of the
> : in both cases (and yes, on git-push that can be slow as we do
> network IO, possibly over SSH).
> 
> So I'm in favor of my patch over yours, but only because of
> the fetch and push fixes as well.
> 

I agree, although I'd rather not have seen the case statement in yours. It's bash completion after all, so no need to be "portably fast" ;-)

I don't care that much though so long as it gets fixed.
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
Previous: Shawn O. Pearce
Message 22 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.