Re* [PATCH v5 3/7] grep tests: add missing "grep.patternType" config test

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> The grep.patternType configuration variable has the "last one wins"
> semantics just all the usual configuration variable, but the meaning
> of the variable when it is set to "default" depends on the value set
> to grep.extendedRegexp variable.
>
> If you rewrite with the above understanding, what you wrote will
> become a lot more concise.
>
>     Extend the grep tests to assert that grep.patternType is the
>     usual "last one wins" variable, and specifically, setting it to
>     "default" has the same meaning as setting it to "basic" when
>     grep.extendedRegexp is not set (or set to false).

Also, it is probably a good idea to strees that grep.extendedRegexp
is also "last one wins", so as I wrote in a separate message, Git
finds the last one for grep.extendedRegexp and grep.patternType
independently and combines these last values to come up with the
pattern type it uses.

I'll tentatively queue the following patch between your 3/7 and 4/7,
but it probably is a good idea to squash it into 3/7, as it belongs
to the same theme: clarify how these two variables are meant to
interact with each other.

----- >8 --------- >8 --------- >8 --------- >8 --------- >8 --------- >8 ----
Subject: [PATCH] t7810: make sure grep.extendedRegexp is also last-one-wins

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 t/t7810-grep.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh
index 113902c3bd..2c17704e01 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -451,6 +451,16 @@ do
 		test_cmp expected actual
 	'
 
+	test_expect_success "grep $L with grep.extendedRegexp is last-one-wins" '
+		echo "${HC}ab:a+bc" >expected &&
+		git \
+			-c grep.extendedRegexp=true \
+			-c grep.patternType=default \
+			-c grep.extendedRegexp=false \
+			grep "a+b*c" $H ab >actual &&
+		test_cmp expected actual
+	'
+
 	test_expect_success "grep $L with grep.patternType=extended and grep.patternType=default" '
 		echo "${HC}ab:a+bc" >expected &&
 		git \
-- 
2.34.1-563-g3368a7891b




[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