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

Re: [PATCH 2/2] completion: add case-insensitive match of pseudorefs

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Nov 20, 2022, 20:46 UTC
Message-ID
<20221120204646.GD4039@szeder.dev>
In-Reply-To
<20221120204232.GC4039@szeder.dev>
On Sun, Nov 20, 2022 at 09:42:32PM +0100, SZEDER Gábor wrote:
Show 23 quoted lines
> On Sat, Nov 05, 2022 at 05:28:35PM +0000, Alison Winters via GitGitGadget wrote:
> > From: Alison Winters <alisonatwork@outlook.com>
> > 
> > When GIT_COMPLETION_IGNORE_CASE=1, also allow lowercase completion text
> > like "head" to match HEAD and other pseudorefs.
> > 
> > Signed-off-by: Alison Winters <alisonatwork@outlook.com>
> > ---
> >  contrib/completion/git-completion.bash | 10 +++++++---
> >  t/t9902-completion.sh                  | 16 ++++++++++++++++
> >  2 files changed, 23 insertions(+), 3 deletions(-)
> > 
> > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> > index 8ed96a5b8b6..161327057da 100644
> > --- a/contrib/completion/git-completion.bash
> > +++ b/contrib/completion/git-completion.bash
> > @@ -745,6 +745,7 @@ __git_refs ()
> >  	local format refs
> >  	local pfx="${3-}" cur_="${4-$cur}" sfx="${5-}"
> >  	local match="${4-}"
> > +	local umatch="${4-}"
> 
> Why 'umatch' and not 'imatch'?

Gah, because it's all _u_pper case, as can be seen in the next hunk, that's why.

Show 13 quoted lines
> >  	local fer_pfx="${pfx//\%/%%}" # "escape" for-each-ref format specifiers
> >  	local ignore_case=""
> >  
> > @@ -772,6 +773,8 @@ __git_refs ()
> >  	if test "${GIT_COMPLETION_IGNORE_CASE-}" = "1"
> >  	then
> >  		ignore_case="--ignore-case"
> > +		# use tr instead of ${match,^^} to preserve bash 3.2 compatibility
> 
> Thank you for keeping compatibility with old versions in mind!
> 
> > +		umatch=$(echo "$match" | tr a-z A-Z 2> /dev/null || echo "$match")
> 
Previous: SZEDER GáborNext: Taylor Blau
Message 6 of 15 in “add case insensitivity option to bash completion”
  1. 0/2 add case insensitivity option to bash completionAlison Winters via GitGitGadget, Nov 5, 2022
  2. 1/2 completion: add optional ignore-case when matching refsAlison Winters via GitGitGadget, Nov 5, 2022
  3. SZEDER GáborNov 20, 2022
  4. 2/2 completion: add case-insensitive match of pseudorefsAlison Winters via GitGitGadget, Nov 5, 2022
  5. SZEDER GáborNov 20, 2022
  6. SZEDER GáborNov 20, 2022
  7. Taylor BlauNov 8, 2022
  8. 0/2 add case insensitivity option to bash completionAlison Winters via GitGitGadget, Nov 21, 2022
  9. 1/2 completion: add optional ignore-case when matching refsAlison Winters via GitGitGadget, Nov 21, 2022
  10. 2/2 completion: add case-insensitive match of pseudorefsAlison Winters via GitGitGadget, Nov 21, 2022
  11. Junio C HamanoNov 29, 2022
  12. Alison WintersNov 29, 2022
  13. Ævar Arnfjörð BjarmasonNov 29, 2022
  14. Alison WintersNov 30, 2022
  15. Junio C HamanoNov 30, 2022

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.