login
Header Space

 
 

Re: [RFC] Git config file reader in Perl (WIP)

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Johannes Schindelin <Johannes.Schindelin@...>
Cc: Nikolai Weibull <now@...>, Junio C Hamano <junkio@...>, Eric Wong <normalperson@...>, <git@...>
Date: Friday, January 19, 2007 - 6:44 pm

Johannes Schindelin wrote:

Something like the patch below? Untested! ("make doc" up to 
git-repo-config.txt compiles, though).

I'm not sure how to tell that you can have [section] if you have
[section "subsection"], but you don't need to. And I probably forgot
to add some information.

And I'm not sure if some behavior should not be changed, for example
allowing _any_ line to be continued with `\`, or that other character
escape sequences and perhaps also octal character sequences should be
allowed (either that or `\b` should not be parsed).

I can send proper patch if requested, but I'd rather above issues
were resolved first.

diff --git a/Documentation/config.txt b/Documentation/config.txt
index da7fde5..9544308 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -14,14 +14,53 @@ dot-separated segment and the section name is everything before the last
 dot. The variable names are case-insensitive and only alphanumeric
 characters are allowed. Some variables may appear multiple times.
 
+Syntax
+~~~~~~
+
 The syntax is fairly flexible and permissive; whitespaces are mostly
-ignored. The '#' and ';' characters begin comments to the end of line,
-blank lines are ignored, lines containing strings enclosed in square
-brackets start sections and all the other lines are recognized
-as setting variables, in the form 'name = value'. If there is no equal
-sign on the line, the entire line is taken as 'name' and the variable
-is recognized as boolean "true". String values may be entirely or partially
-enclosed in double quotes; some variables may require special value format.
+ignored.  The '#' and ';' characters begin comments to the end of line,
+blank lines are ignored.
+
+The file consists of sections and variables.  A section begins with
+the name of the section in square brackets and continues until the next
+section begins.  Section names are not case sensitive.  Each variable
+must belong to some section, which means that there must be section
+header before first setting of a variable.
+
+Sections can be further divided into subsections.  To begin a subsection
+put it name in double quotes, separated by space from the section name,
+in the section header, like in example below
+
+	[section "subsection"]
+
+Subsection names can contain whitespace and are case sensitive.  Variables
+may belong directly to a section, or to a given subsection.
+
+All the other lines are recognized as setting variables, in the form
+'name = value'. If there is no equal sign on the line, the entire line
+is taken as 'name' and the variable is recognized as boolean "true".
+Variable names are case insensitive.  There can be more than one value
+for a given variable; we say then that variable is multivalued.
+
+Leading and trailing whitespace in a variable value is discarded.
+Internal whitespace within a variable value is retained verbatim.
+
+String values may be entirely or partially enclosed in double quotes.
+You need to enclose variable value in double quotes if you want to
+preserve leading or trailing whitespace, or if variable value contains
+beginning of comment characters, it means if it contains `#` or `;`.
+Double quote `"` and backslash `\` characters in variable value must
+be escaped: use `\"` for `"`, and `\\` for `\`.
+
+The following escape sequences (beside `\"` and `\\`) are recognized:
+`\n` for newline character (NL), `\t` for horizontal tabulation (HT, TAB)
+and `\b` for backspace (BS).  No other character escape codes, nor octal
+char sequences are valid.
+
+Variable value ending in a `\` is continued on the next line in the 
+customary UNIX fashion.
+
+Some variables may require special value format.
 
 Example
 ~~~~~~~
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Sun Jan 14, 8:44 pm)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Mon Jan 15, 3:08 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Mon Jan 15, 5:03 am)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Mon Jan 15, 5:56 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Mon Jan 15, 6:32 am)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Mon Jan 15, 7:26 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Mon Jan 15, 8:15 am)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Tue Jan 16, 5:51 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Tue Jan 16, 6:47 am)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Tue Jan 16, 3:53 pm)
Re: [RFC] Git config file reader in Perl (WIP), Nikolai Weibull, (Mon Jan 15, 11:34 am)
Re: [RFC] Git config file reader in Perl (WIP), Junio C Hamano, (Tue Jan 16, 6:45 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Tue Jan 16, 7:12 am)
Re: [RFC] Git config file reader in Perl (WIP), Eric Wong, (Tue Jan 16, 3:09 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Tue Jan 16, 10:14 am)
Re: [RFC] Git config file reader in Perl (WIP), Nikolai Weibull, (Tue Jan 16, 6:17 pm)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Tue Jan 16, 6:42 pm)
Re: [RFC] Git config file reader in Perl (WIP), Nikolai Weibull, (Wed Jan 17, 2:08 pm)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Wed Jan 17, 8:50 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Wed Jan 17, 3:25 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Wed Jan 17, 3:22 pm)
Re: [RFC] Git config file reader in Perl (WIP), Nikolai Weibull, (Wed Jan 17, 4:01 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Tue Jan 16, 6:37 pm)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Tue Jan 16, 6:56 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Tue Jan 16, 7:24 pm)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Wed Jan 17, 4:51 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Wed Jan 17, 5:48 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Wed Jan 17, 6:44 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Wed Jan 17, 8:11 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Wed Jan 17, 8:37 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Wed Jan 17, 10:00 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Fri Jan 19, 8:10 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Fri Jan 19, 9:20 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Fri Jan 19, 6:44 pm)
Re: [RFC] Git config file reader in Perl (WIP), Junio C Hamano, (Fri Jan 19, 8:19 pm)
[PATCH] config_set_multivar(): disallow newlines in keys, Johannes Schindelin, (Fri Jan 19, 9:25 pm)
Re: [PATCH] config_set_multivar(): disallow newlines in keys, Johannes Schindelin, (Mon Jan 22, 11:21 am)
Re: [PATCH] config_set_multivar(): disallow newlines in keys, Johannes Schindelin, (Mon Jan 22, 11:44 am)
Re: [PATCH] config_set_multivar(): disallow newlines in keys, Johannes Schindelin, (Tue Jan 23, 7:26 am)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Fri Jan 19, 8:08 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Fri Jan 19, 8:59 pm)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Fri Jan 19, 8:25 am)
Re: [RFC] Git config file reader in Perl (WIP), Jakub Narebski, (Mon Jan 15, 12:00 pm)
Re: [RFC] Git config file reader in Perl (WIP), Johannes Schindelin, (Mon Jan 15, 11:44 am)
Re: [RFC] Git config file reader in Perl (WIP), Nikolai Weibull, (Mon Jan 15, 12:22 pm)
Re: [RFC] Git config file reader in Perl (WIP), Shawn O. Pearce, (Mon Jan 15, 6:01 am)
speck-geostationary