git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] CodingGuidelines: describe naming rules for configuration variables

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 28, 2015, 22:33 UTC
Message-ID
<1422484393-4414-4-git-send-email-gitster@pobox.com>
In-Reply-To
<1422484393-4414-1-git-send-email-gitster@pobox.com>

We may want to say something about command line option names in the new section as well, but for now, let's make sure everybody is clear on how to structure and name their configuration variables.

The text for the rules are partly taken from the log message of Jonathan's 6b3020a2 (add: introduce add.ignoreerrors synonym for add.ignore-errors, 2010-12-01).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 Documentation/CodingGuidelines | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
index 894546d..8fbac15 100644
--- a/Documentation/CodingGuidelines
+++ b/Documentation/CodingGuidelines
@@ -413,6 +413,31 @@ Error Messages
  - Say what the error is first ("cannot open %s", not "%s: cannot open")
 
 
+Externally Visible Names
+
+ - For configuration variable names, follow the existing convention:
+
+   . The section name indicates the affected subsystem.
+
+   . The subsection name, if any, indicates which of an unbounded set
+     of things to set the value for.
+
+   . The variable name describes the effect of tweaking this knob.
+
+   The section and variable names that consist of multiple words are
+   formed by concatenating the words without punctuations (e.g. `-`),
+   and are broken using bumpyCaps in documentation as a hint to the
+   reader.
+
+   When choosing the variable namespace, do not use variable name for
+   specifying possibly unbounded set of things, most notably anything
+   an end user can freely come up with (e.g. branch names), but also
+   large fixed set defined by the system that can grow over time
+   (e.g. what kind of common whitespace problems to notice).  Use
+   subsection names or variable values, like existing variables
+   branch.<name>.description and core.whitespace do, instead.
+
+
 Writing Documentation:
 
  Most (if not all) of the documentation pages are written in the
-- 
2.3.0-rc2-149-gdd42ee9
Previous: Junio C HamanoNext: Michael Haggerty
Message 7 of 16 in “Documentation/git-add.txt: add `add.ginore-errors` configuration variable”
  1. Documentation/git-add.txt: add `add.ginore-errors` configuration variableAlexander Kuleshov, Jan 26, 2015
  2. Eric SunshineJan 26, 2015
  3. Junio C HamanoJan 27, 2015
  4. 0/3 Documenting naming rules for configuration variablesJunio C Hamano, Jan 28, 2015
  5. 1/3 config.txt: clarify that add.ignore-errors is deprecatedJunio C Hamano, Jan 28, 2015
  6. 2/3 config.txt: mark deprecated variables more prominentlyJunio C Hamano, Jan 28, 2015
  7. 3/3 CodingGuidelines: describe naming rules for configuration variablesJunio C Hamano, Jan 28, 2015
  8. Michael HaggertyFeb 1, 2015
  9. Jeff KingFeb 1, 2015
  10. Junio C HamanoFeb 1, 2015
  11. Jeff KingFeb 1, 2015
  12. Junio C HamanoFeb 1, 2015
  13. Johannes SchindelinFeb 2, 2015
  14. Junio C HamanoFeb 2, 2015
  15. Michael HaggertyFeb 2, 2015
  16. Junio C HamanoFeb 2, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.