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

Re: [BUG?] "git config --replace-all key value value_regex" ignores value_regex?

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 18, 2020, 20:28 UTC
Message-ID
<xmqq8say1kbq.fsf@gitster.c.googlers.com>
In-Reply-To
<c7dfbd1b-44bc-d074-5ec9-1011738c1522@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 20 quoted lines
>>> 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.

Previous: Derrick Stolee
Message 4 of 4 in “[BUG?] "git config --replace-all key value value_regex" ignores value_regex?”
  1. Derrick StoleeNov 18, 2020
  2. Junio C HamanoNov 18, 2020
  3. Derrick StoleeNov 18, 2020
  4. Junio C HamanoNov 18, 2020

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.