summaryrefslogtreecommitdiff
path: root/Documentation/CodingGuidelines
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/CodingGuidelines')
-rw-r--r--Documentation/CodingGuidelines24
1 files changed, 18 insertions, 6 deletions
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 1d95a142b2..003393ed16 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -162,8 +162,6 @@ For shell scripts specifically (not exhaustive):
- We do not use \{m,n\};
- - We do not use -E;
-
- We do not use ? or + (which are \{0,1\} and \{1,\}
respectively in BRE) but that goes without saying as these
are ERE elements not BRE (note that \? and \+ are not even part
@@ -444,8 +442,12 @@ For C programs:
detail.
- The first #include in C files, except in platform specific compat/
- implementations, must be either "git-compat-util.h", "cache.h" or
- "builtin.h". You do not have to include more than one of these.
+ implementations and sha1dc/, must be either "git-compat-util.h" or
+ one of the approved headers that includes it first for you. (The
+ approved headers currently include "cache.h", "builtin.h",
+ "t/helper/test-tool.h", "xdiff/xinclude.h", or
+ "reftable/system.h"). You do not have to include more than one of
+ these.
- A C file must directly include the header files that declare the
functions and the types it uses, except for the functions and types
@@ -665,8 +667,8 @@ Writing Documentation:
(One or more of <file>.)
Optional parts are enclosed in square brackets:
- [<extra>]
- (Zero or one <extra>.)
+ [<file>...]
+ (Zero or more of <file>.)
--exec-path[=<path>]
(Option with an optional argument. Note that the "=" is inside the
@@ -680,6 +682,16 @@ Writing Documentation:
[-q | --quiet]
[--utf8 | --no-utf8]
+ Use spacing around "|" token(s), but not immediately after opening or
+ before closing a [] or () pair:
+ Do: [-q | --quiet]
+ Don't: [-q|--quiet]
+
+ Don't use spacing around "|" tokens when they're used to seperate the
+ alternate arguments of an option:
+ Do: --track[=(direct|inherit)]
+ Don't: --track[=(direct | inherit)]
+
Parentheses are used for grouping:
[(<rev> | <range>)...]
(Any number of either <rev> or <range>. Parens are needed to make