aboutsummaryrefslogtreecommitdiff
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-04-30 14:24:52 -0700
committerJunio C Hamano <gitster@pobox.com>2014-05-02 13:24:57 -0700
commit9dbe780174892a35d6f1e19495c13b9edb9d88fd (patch)
tree15961f95b6cb017492acd6c3589f9ae141a00fc1 /Documentation/CodingGuidelines
parent6a49909b52b48592234da6a53bfe74ea34c302c6 (diff)
downloadgit-9dbe780174892a35d6f1e19495c13b9edb9d88fd.tar.gz
git-9dbe780174892a35d6f1e19495c13b9edb9d88fd.tar.xz
CodingGuidelines: give an example for control statements
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines11
1 files changed, 11 insertions, 0 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 11704fb84..47db6b3ce 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -107,6 +107,17 @@ For shell scripts specifically (not exhaustive):
"then" should be on the next line for if statements, and "do"
should be on the next line for "while" and "for".
+ (incorrect)
+ if test -f hello; then
+ do this
+ fi
+
+ (correct)
+ if test -f hello
+ then
+ do this
+ fi
+
- We prefer "test" over "[ ... ]".
- We do not write the noiseword "function" in front of shell