git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Derrick Stolee <stolee@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jeff King <peff@peff.net>,
	Emily Shaffer <emilyshaffer@google.com>
Subject: Re: [BUG?] "git config --replace-all key value value_regex" ignores value_regex?
Date: Wed, 18 Nov 2020 12:28:09 -0800	[thread overview]
Message-ID: <xmqq8say1kbq.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <c7dfbd1b-44bc-d074-5ec9-1011738c1522@gmail.com> (Derrick Stolee's message of "Wed, 18 Nov 2020 14:42:37 -0500")

Derrick Stolee <stolee@gmail.com> writes:

>>> test_expect_success '--replace-all and value_regex' '
>>> 	q_to_tab >.git/config <<-\EOF &&
>>> 	[abc]
>>> 	Qkey = one
>>> 	Qkey = two
>>> 	Qkey = three
>>> 	EOF
>>> 	q_to_tab >expect <<-\EOF &&
>>> 	[abc]
>>> 	Qkey = four
>>> 	Qkey = two
>>> 	Qkey = three
>>> 	EOF
>>> 	git config --replace-all abc.key four "o*" &&
>>> 	test_cmp expect .git/config
>>> '
>> ...
> Thank you. Naturally, PEBKAC and my lack of understanding the
> regex I was using in my own test. Clearly this is behaving
> correctly. Modifying as suggested shows this works properly.

It is an easy confusion.

When I see a pattern, especially a single letter followed by an
asterisk like "o*", my eyes take it as a glob pattern that is left
anchored, i.e. "any string that begins with an 'o'", and if that
were the matching rule, what you expected is totally the natural
outcome.  But here we unfortunately are looking at ERE.


      reply	other threads:[~2020-11-18 20:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 18:07 [BUG?] "git config --replace-all key value value_regex" ignores value_regex? Derrick Stolee
2020-11-18 18:54 ` Junio C Hamano
2020-11-18 19:42   ` Derrick Stolee
2020-11-18 20:28     ` Junio C Hamano [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=xmqq8say1kbq.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=stolee@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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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