* [PATCH] CodingGuidelines: Fix a typo
@ 2010-10-09 11:18 stepnem
2010-10-09 15:27 ` Jonathan Nieder
0 siblings, 1 reply; 5+ messages in thread
From: stepnem @ 2010-10-09 11:18 UTC (permalink / raw)
To: gitster; +Cc: git
From: Štěpán Němec <stepnem@gmail.com>
`${parameter/pattern/string}' shell expansion uses glob patterns, so
talking about `regexp' is confusing.
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
---
Documentation/CodingGuidelines | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8346c19..df50ccf 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -53,7 +53,7 @@ For shell scripts specifically (not exhaustive):
- No strlen ${#parameter}.
- - No regexp ${parameter/pattern/string}.
+ - No substitution ${parameter/pattern/string}.
- We do not use Process Substitution <(list) or >(list).
--
1.7.3.rc2.221.gbf93f.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] CodingGuidelines: Fix a typo
2010-10-09 11:18 [PATCH] CodingGuidelines: Fix a typo stepnem
@ 2010-10-09 15:27 ` Jonathan Nieder
2010-10-09 17:35 ` Štěpán Němec
2010-10-09 17:51 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Nieder @ 2010-10-09 15:27 UTC (permalink / raw)
To: stepnem; +Cc: gitster, git
stepnem@gmail.com wrote:
> `${parameter/pattern/string}' shell expansion uses glob patterns, so
> talking about `regexp' is confusing.
Okay.
> - - No regexp ${parameter/pattern/string}.
> + - No substitution ${parameter/pattern/string}.
A bit confusing, since ${parameter%word} and $parameter are
substitutions, too.
Maybe
- No pattern substitution ${parameter/pattern/string}.
to match the bash manual, would be clearer?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] CodingGuidelines: Fix a typo
2010-10-09 15:27 ` Jonathan Nieder
@ 2010-10-09 17:35 ` Štěpán Němec
2010-10-09 17:51 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Štěpán Němec @ 2010-10-09 17:35 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: gitster, git
Jonathan Nieder <jrnieder@gmail.com> writes:
> stepnem@gmail.com wrote:
>
>> `${parameter/pattern/string}' shell expansion uses glob patterns, so
>> talking about `regexp' is confusing.
>
> Okay.
>
>> - - No regexp ${parameter/pattern/string}.
>> + - No substitution ${parameter/pattern/string}.
>
> A bit confusing, since ${parameter%word} and $parameter are
> substitutions, too.
Not really. They are all parameter expansions. The former a "pattern
removal", the latter a plain expansion (yeah I know you can _call_ it a
substitution anyway, but I assume you were trying to be precise/match
the Bash manual wording here).
But I agree "pattern substitution" is even clearer, thanks.
BTW, when we continue on this slightly bike-shedding note, it would make
sense to unify the capitalisation of those termini technici in there
("Arithmetic Expansion", "Process Substitution"). Personally I would
prefer having them all in lower-case; it feels a bit funny to read "We
use Arithmetic Expansion". WDYT?
I hope the whitespace goes through undisturbed this time:
--- 8< ---
Subject: CodingGuidelines: Fix a typo
`${parameter/pattern/string}' shell expansion uses glob patterns, so
talking about `regexp' is confusing.
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
---
Documentation/CodingGuidelines | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8346c19..e52474b 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -53,7 +53,7 @@ For shell scripts specifically (not exhaustive):
- No strlen ${#parameter}.
- - No regexp ${parameter/pattern/string}.
+ - No pattern substitution ${parameter/pattern/string}.
- We do not use Process Substitution <(list) or >(list).
--
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] CodingGuidelines: Fix a typo
2010-10-09 15:27 ` Jonathan Nieder
2010-10-09 17:35 ` Štěpán Němec
@ 2010-10-09 17:51 ` Junio C Hamano
2010-10-11 6:44 ` Jonathan Nieder
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2010-10-09 17:51 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: stepnem, git
Jonathan Nieder <jrnieder@gmail.com> writes:
> stepnem@gmail.com wrote:
>
>> `${parameter/pattern/string}' shell expansion uses glob patterns, so
>> talking about `regexp' is confusing.
>
> Okay.
>
>> - - No regexp ${parameter/pattern/string}.
>> + - No substitution ${parameter/pattern/string}.
>
> A bit confusing, since ${parameter%word} and $parameter are
> substitutions, too.
I had the same reaction. Perhaps moving other parameter substitions
closer to these two would help?
Side note: this is totally unrelated, but the below is --patience;
our output without --patience is almost unreadable in this case.
Documentation/CodingGuidelines | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 8346c19..09ffc46 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -35,11 +35,22 @@ For shell scripts specifically (not exhaustive):
properly nests. It should have been the way Bourne spelled
it from day one, but unfortunately isn't.
- - We use ${parameter-word} and its [-=?+] siblings, and their
- colon'ed "unset or null" form.
+ - We use POSIX compliant parameter substitutions and avoid bashisms;
+ namely:
- - We use ${parameter#word} and its [#%] siblings, and their
- doubled "longest matching" form.
+ - We use ${parameter-word} and its [-=?+] siblings, and their
+ colon'ed "unset or null" form.
+
+ - We use ${parameter#word} and its [#%] siblings, and their
+ doubled "longest matching" form.
+
+ - No "Substring Expansion" ${parameter:offset:length}.
+
+ - No shell arrays.
+
+ - No strlen ${#parameter}.
+
+ - No pattern replacement ${parameter/pattern/string}.
- We use Arithmetic Expansion $(( ... )).
@@ -47,14 +58,6 @@ For shell scripts specifically (not exhaustive):
of them, as some shells do not grok $((x)) while accepting $(($x))
just fine (e.g. dash older than 0.5.4).
- - No "Substring Expansion" ${parameter:offset:length}.
-
- - No shell arrays.
-
- - No strlen ${#parameter}.
-
- - No regexp ${parameter/pattern/string}.
-
- We do not use Process Substitution <(list) or >(list).
- We prefer "test" over "[ ... ]".
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] CodingGuidelines: Fix a typo
2010-10-09 17:51 ` Junio C Hamano
@ 2010-10-11 6:44 ` Jonathan Nieder
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Nieder @ 2010-10-11 6:44 UTC (permalink / raw)
To: Junio C Hamano; +Cc: stepnem, git
Junio C Hamano wrote:
> I had the same reaction. Perhaps moving other parameter substitions
> closer to these two would help?
Yes, that looks like a definite improvement.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-11 6:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-09 11:18 [PATCH] CodingGuidelines: Fix a typo stepnem
2010-10-09 15:27 ` Jonathan Nieder
2010-10-09 17:35 ` Štěpán Němec
2010-10-09 17:51 ` Junio C Hamano
2010-10-11 6:44 ` Jonathan Nieder
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).