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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin wrote:
> 
> On Wed, 17 Jan 2007, Jakub Narebski wrote:
> 
>> Johannes Schindelin wrote:
>>> 
>>> On Wed, 17 Jan 2007, Jakub Narebski wrote:
>>> 
>>>> Johannes Schindelin wrote:
>>>> 
>>>>> 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
>> 
>> $ fatal: bad config file line <nn> in <config>
> 
> Yeah, sorry. But you got the point.

No, I don't got the point. No key or value can contain "\n".

>>>> 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.
>> 
>> But only for "git repo-config --bool --get section.noval" output.
>> Semantically equivalent to "true".
>> 
>> But without --bool it returns like it was "".
> 
> Yes, it returns "", but this is _wrong_. A single "[section] noval" _only_ 
> makes sense as a boolean. The information lies in its _presence_, which is 
> as good as saying "true".

With "\n" as separator you can simply rrturn NUL in the noval case.

-- 
Jakub Narebski
Poland
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]