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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Derrick Stolee <stolee@xxxxxxxxx> writes:

> --replace-all::
> 	Default behavior is to replace at most one line. This replaces
> 	all lines matching the key (and optionally the value_regex).
>
> However, this test fails:
>
> 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
> '

I do not know or try to guess the original intention (I thought this
is Dscho's thing, no?), but if there are one/two/three and I were
asked to replace all of those that have zero or more 'o' in it with
'four' I would expect that

 (1) all three be removed, because they all have zero or more 'o',
     and then

 (2) one instance of 'four' be added,

resulting in a single 'four' left.

If the value_regex were "o+" (since it takes ERE) to mean one or
more, then my expectation would be

 (1) one and two be removed, because 'three' does not match, and
     then

 (2) one instance of 'four' be added,

resulting in two items, 'three' and 'four'.

An alternative interpretation would be that each of the removed
entries is replaced with a new one, resulting in three entries
(i.e. with "o*", it would leave three identical entries 'four',
with "o+", it would leave 'four', 'four' and 'three'), but that
may be less useful in practice.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux