Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Alison Winters via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Alison Winters <alisonatwork@outlook.com>
Subject: Re: [PATCH 2/2] completion: add case-insensitive match of pseudorefs
Date: Sun, 20 Nov 2022 21:46:46 +0100	[thread overview]
Message-ID: <20221120204646.GD4039@szeder.dev> (raw)
In-Reply-To: <20221120204232.GC4039@szeder.dev>

On Sun, Nov 20, 2022 at 09:42:32PM +0100, SZEDER Gábor wrote:
> 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.

> >  	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")
> 

  reply	other threads:[~2022-11-20 20:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 17:28 [PATCH 0/2] add case insensitivity option to bash completion Alison Winters via GitGitGadget
2022-11-05 17:28 ` [PATCH 1/2] completion: add optional ignore-case when matching refs Alison Winters via GitGitGadget
2022-11-20 20:24   ` SZEDER Gábor
2022-11-05 17:28 ` [PATCH 2/2] completion: add case-insensitive match of pseudorefs Alison Winters via GitGitGadget
2022-11-20 20:42   ` SZEDER Gábor
2022-11-20 20:46     ` SZEDER Gábor [this message]
2022-11-08  3:00 ` [PATCH 0/2] add case insensitivity option to bash completion Taylor Blau
2022-11-21  0:26 ` [PATCH v2 " Alison Winters via GitGitGadget
2022-11-21  0:26   ` [PATCH v2 1/2] completion: add optional ignore-case when matching refs Alison Winters via GitGitGadget
2022-11-21  0:26   ` [PATCH v2 2/2] completion: add case-insensitive match of pseudorefs Alison Winters via GitGitGadget
2022-11-29  2:38 ` [PATCH 0/2] add case insensitivity option to bash completion Junio C Hamano
2022-11-29 15:56   ` Alison Winters
2022-11-29 17:40     ` Ævar Arnfjörð Bjarmason
2022-11-30  0:37       ` Alison Winters
2022-11-30  3:08         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221120204646.GD4039@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=alisonatwork@outlook.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).