diff options
author | Junio C Hamano <gitster@pobox.com> | 2010-10-13 20:20:09 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2010-10-13 20:20:09 -0700 |
commit | 38a18873b21f6f2eebedc65aff2249fd6ec2168c (patch) | |
tree | 5f7d8cce901a2317a8fbdef7bce2fb85742be1fc /Documentation/CodingGuidelines | |
parent | 2794ad524462c4e2ecd4573d650e7b4f8da89a5d (diff) | |
parent | 352953a556e7f8d720e26a32d4aabbf823d3c4d4 (diff) | |
download | git-38a18873b21f6f2eebedc65aff2249fd6ec2168c.tar.gz |
Merge branch 'maint'
* maint:
Better advice on using topic branches for kernel development
Documentation: update implicit "--no-index" behavior in "git diff"
Documentation: expand 'git diff' SEE ALSO section
Documentation: diff can compare blobs
Documentation: gitrevisions is in section 7
shell portability: no "export VAR=VAL"
CodingGuidelines: reword parameter expansion section
Documentation: update-index: -z applies also to --index-info
Documentation: No argument of ALLOC_GROW should have side-effects
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r-- | Documentation/CodingGuidelines | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines index 8346c1972b..09ffc46563 100644 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@ -35,25 +35,28 @@ 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 Arithmetic Expansion $(( ... )). + - We use ${parameter#word} and its [#%] siblings, and their + doubled "longest matching" form. - - Inside Arithmetic Expansion, spell shell variables with $ in front - 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 "Substring Expansion" ${parameter:offset:length}. + - No shell arrays. - - No shell arrays. + - No strlen ${#parameter}. - - No strlen ${#parameter}. + - No pattern replacement ${parameter/pattern/string}. - - No regexp ${parameter/pattern/string}. + - We use Arithmetic Expansion $(( ... )). + + - Inside Arithmetic Expansion, spell shell variables with $ in front + of them, as some shells do not grok $((x)) while accepting $(($x)) + just fine (e.g. dash older than 0.5.4). - We do not use Process Substitution <(list) or >(list). |