Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > Extend the grep tests to assert that setting > "grep.patternType=extended" followed by "grep.patternType=default" > will behave as if "--extended-regexp" was provided, and not as > "--basic-regexp". grep.patternType is the usual "last-one wins". If the last value set to patternType is the default, the setting to grep.extendedRegexp should take effect (so if it is set to true, we'd see ERE behavour). Back in the days when the "return to the default matching behavior" part was written in 84befcd0 (grep: add a grep.patternType configuration setting, 2012-08-03), grep.extendedRegexp was the only way to configure the behaviour since b22520a3 (grep: allow -E and -n to be turned on by default via configuration, 2011-03-30). It was understandable that we referred to the behaviour that honors the older configuration variable as "the default matching" behaviour. It is fairly clear in its log message: When grep.patternType is set to a value other than "default", the grep.extendedRegexp setting is ignored. The value of "default" restores the current default behavior, including the grep.extendedRegexp behavior. So, unless your description is a typo, I am somewhat surprised by your findings that =default that comes later does not defeat an earlier =extended. It should just clear that earlier extended set by grep.patternType and only pay attention to grep.extendedRegexp variable. Doing anything else is a bug, I think. Thanks. diff --git i/Documentation/config/grep.txt w/Documentation/config/grep.txt index 44abe45a7c..95fcb3ca29 100644 --- i/Documentation/config/grep.txt +++ w/Documentation/config/grep.txt @@ -8,7 +8,8 @@ grep.patternType:: Set the default matching behavior. Using a value of 'basic', 'extended', 'fixed', or 'perl' will enable the `--basic-regexp`, `--extended-regexp`, `--fixed-strings`, or `--perl-regexp` option accordingly, while the - value 'default' will return to the default matching behavior. + value 'default' will return to the default matching behavior, which is, + to honor `grep.extendedRegexp` option and choose either basic or extended. grep.extendedRegexp:: If set to true, enable `--extended-regexp` option by default. This