CodingGuidelines: give an example for control statements
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Apr 30, 2014 at 14:24 UTC
9dbe780174892a35d6f1e19495c13b9edb9d88fd
1 file changed
+11
Documentation/CodingGuidelines
+11
@@ -107,6 +107,17 @@ For shell scripts specifically (not exhaustive):
107
"then" should be on the next line for if statements, and "do"
108
should be on the next line for "while" and "for".
109
110
+ (incorrect)
111
+ if test -f hello; then
112
+ do this
113
+ fi
114
+
115
+ (correct)
116
+ if test -f hello
117
+ then
118
+ do this
119
+ fi
120
+
121
- We prefer "test" over "[ ... ]".
122
123
- We do not write the noiseword "function" in front of shell