Skip to contentSkip to conversation

grep: clarify what `grep.patternType=default` means

PATCH Superseded Junio C Hamano 2 participants 4 messages Nov 29, 2021 – Dec 5, 2021 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grep: clarify what `grep.patternType=default` means

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.

But when the paragraph is read in isolation by a new person who is not aware of that backstory (which is the synonym for "most users"), the "default matching behaviour" can be read as "how 'git grep' behaves without any configuration variables or options", which is "match the pattern as BRE".

Clarify what the passage means by elaborating what the phrase "default matching behaviour" wanted to mean.

---

* Whether the eventual deprecation of grep.extendedRegexp is a good idea, we'd need something like this to clarify what these two variables are meant to interact with each other first.

 Documentation/config/grep.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/config/grep.txt +2 -1
index 44abe45a7c..72f5e03614 100644
@@ -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 use the settings of `grep.extendedRegexp` option
+	to choose between `basic` and `extended`.
 
 grep.extendedRegexp::
 	If set to true, enable `--extended-regexp` option by default. This
Signature · 1 line
2.34.1-251-g6783e24198
#1 lore raw
Quoted 5 lines · Junio C Hamano

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

The 'the "return to the default matching behavior" part' is a forward reference, so I tried this instead:

Commit 84befcd0 (grep: add a grep.patternType configuration setting, 2012-08-03) documented that grep.patternType=default falls back to the "default matching behavior". Prior to that, grep.extendedRegexp was the only way to configure the matching behavior (since b22520a3 (grep: allow -E and -n to be turned on by default via configuration, 2011-03-30)).

Quoted 2 lines

It was understandable that we referred to the behaviour that honors

"It was" -> "It is"?

Quoted 2 lines

the older configuration variable as "the default matching" behaviour. It is fairly clear in its log message:

I guess %s/behaviour/behavior/

Quoted 30 lines

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.

But when the paragraph is read in isolation by a new person who is not aware of that backstory (which is the synonym for "most users"), the "default matching behaviour" can be read as "how 'git grep' behaves without any configuration variables or options", which is "match the pattern as BRE".

Clarify what the passage means by elaborating what the phrase "default matching behaviour" wanted to mean.

---

* Whether the eventual deprecation of grep.extendedRegexp is a good idea, we'd need something like this to clarify what these two variables are meant to interact with each other first.

 Documentation/config/grep.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/config/grep.txt +0 -0
index 44abe45a7c..72f5e03614 100644

Documentation/config/grep.txt grep.patternType:: · line 12

Quoted 6 lines
Documentation/config/grep.txt +2 -1
@@ -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 use the settings of `grep.extendedRegexp` option
+	to choose between `basic` and `extended`.

Yes, much better.
Maybe "settings" -> "value". Probably subjective but plural sounds weird since grep.extendedRegexp is just one bit.

Also this introduces a local inconsistency: above we write 'basic' and here basic.

Quoted 6 lines
Documentation/config/grep.txt +0 -0
 grep.extendedRegexp::
 	If set to true, enable `--extended-regexp` option by default. This
Signature · 1 line
2.34.1-251-g6783e24198
#2 lore raw

Re* [PATCH] grep: clarify what `grep.patternType=default` means

Quoted 16 lines · Johannes Altmanninger
Quoted 5 lines · Junio C Hamano

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

The 'the "return to the default matching behavior" part' is a forward reference, so I tried this instead:

Commit 84befcd0 (grep: add a grep.patternType configuration setting, 2012-08-03) documented that grep.patternType=default falls back to the "default matching behavior". Prior to that, grep.extendedRegexp was the only way to configure the matching behavior (since b22520a3 (grep: allow -E and -n to be turned on by default via configuration, 2011-03-30)).

Quoted 7 lines
Quoted 1 line

It was understandable that we referred to the behaviour that honors

"It was" -> "It is"?

Quoted 2 lines

the older configuration variable as "the default matching" behaviour. It is fairly clear in its log message:

I guess %s/behaviour/behavior/

Let me steal that.

Quoted 16 lines

Documentation/config/grep.txt grep.patternType:: · line 12

Quoted 11 lines
Documentation/config/grep.txt +2 -1
index 44abe45a7c..72f5e03614 100644
@@ -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 use the settings of `grep.extendedRegexp` option
+	to choose between `basic` and `extended`.

Yes, much better.
Maybe "settings" -> "value". Probably subjective but plural sounds weird since grep.extendedRegexp is just one bit.

Quoted 1 line

Also this introduces a local inconsistency: above we write 'basic' and here basic.

Thanks for carefully reading.

#3 lore raw

PATCH v2 1/1 grep: clarify what `grep.patternType=default` means

We documented that with grep.patternType set to default, the "git grep" command returns to "the default matching behavior" in 84befcd0 (grep: add a grep.patternType configuration setting, 2012-08-03).

The grep.extendedRegexp configuration variable was the only way to configure the behavior before that, after b22520a3 (grep: allow -E and -n to be turned on by default via configuration, 2011-03-30) introduced it.

It is understandable that we referred to the behavior that honors the older configuration variable as "the default matching" behavior. 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.

But when the paragraph is read in isolation by a new person who is not aware of that backstory (which is the synonym for "most users"), the "default matching behavior" can be read as "how 'git grep' behaves without any configuration variables or options", which is "match the pattern as BRE".

Clarify what the passage means by elaborating what the phrase "default matching behavior" wanted to mean.

---

1: 39afc16050 ! 1: b6a542173b grep: clarify what grep.patternType=default means
@@ Metadata
## Commit message ##
grep: clarify what grep.patternType=default means

- 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).
+ We documented that with grep.patternType set to default, the "git
+ grep" command returns to "the default matching behavior" in 84befcd0
+ (grep: add a grep.patternType configuration setting, 2012-08-03).

- It was understandable that we referred to the behaviour that honors
+ The grep.extendedRegexp configuration variable was the only way to
+ configure the behavior before that, after b22520a3 (grep: allow -E
+ and -n to be turned on by default via configuration, 2011-03-30)
+ introduced it.
+
+ It is understandable that we referred to the behavior that honors
the older configuration variable as "the default matching"
- behaviour. It is fairly clear in its log message:
+ behavior. 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
@@ Commit message

But when the paragraph is read in isolation by a new person who is not aware of that backstory (which is the synonym for "most users"),
- the "default matching behaviour" can be read as "how 'git grep'
+ the "default matching behavior" can be read as "how 'git grep'
behaves without any configuration variables or options", which is "match the pattern as BRE".

Clarify what the passage means by elaborating what the phrase
- "default matching behaviour" wanted to mean.
+ "default matching behavior" wanted to mean.

+ Helped-by: Johannes Altmanninger <[email protected]>

## Documentation/config/grep.txt ##
@@ Documentation/config/grep.txt: grep.patternType::
'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 use the settings of grep.extendedRegexp option
-+ to choose between basic and extended.
++ value 'default' will use the grep.extendedRegexp option to choose
++ between 'basic' and 'extended'.

grep.extendedRegexp::
If set to true, enable --extended-regexp option by default. This

 Documentation/config/grep.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/config/grep.txt +2 -1
index 44abe45a7c..182edd813a 100644
@@ -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 use the `grep.extendedRegexp` option to choose
+	between 'basic' and 'extended'.
 
 grep.extendedRegexp::
 	If set to true, enable `--extended-regexp` option by default. This
Signature · 1 line
2.34.1-308-g0a2b0356a8