Re: [RFC] Git config file reader in Perl (WIP)
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jan 17, 2007, 08:51 UTC
- Message-ID
- <Pine.LNX.4.63.0701170948420.22628@wbgn013.biozentrum.uni-wuerzburg.de>
- In-Reply-To
- <200701170024.10640.jnareb@gmail.com>
Hi,
On Wed, 17 Jan 2007, Jakub Narebski wrote:
Show 18 quoted lines
> Dnia wtorek 16. stycznia 2007 23:56, Johannes Schindelin napisa?: > > > > On Tue, 16 Jan 2007, Jakub Narebski wrote: > > >> Well, the idea I had was to have --dump switch to git-repo-config to > >> dump init file as if it was created by git-repo-config invocations, > >> without any hand editing (canonical format). > > > > My point still stands: if you already parse the user-friendly format, why > > not dump a parse friendly format? If it weren't for those darn non-alnums > > in the keys, out put of "git repo-config -l" would be perfectly > > acceptable. > > > > So, how about a "git repo-config --dump" which outputs a stream of NUL > > separated keys and values? This should be really easy to "parse", and > > there are no ambiguities: No key or value can contain a NUL. > > Good idea, although "\n" would work as well as NUL.
No it would not:
[someSection] thisKey = has\na\nvalue\with\nseveral\nnewlines
Show 8 quoted lines
> The only problem is with "key without value" case, i.e. something like > > [section] > noval > > which shows as > > section.noval
but is equivalent to
[section] noval = true
Since it is by definition a boolean value.
Show 5 quoted lines
> in "git repo-config -l" output (note missing '=' !), and I guess differs > for some case from > > [section] > noval =
Yes, this is not a boolean. The difference is that the callback function is called with NULL in the former case, and with "" in the latter.
Hth, Dscho