Re: [GSoC RFC PATCH v2 0/7] repo-info: add new command for retrieving repository info

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

 



Phillip Wood <phillip.wood123@xxxxxxxxx> writes:

> The reason git uses NUL termination for other commands is to prevent
> breaking the output when values contain newlines. The output format
> I'm suggesting is
>
>     <key><LF><value><NUL>
>
> so the output for "path.git-dir" written as a C string would be
>
>     "path.git-dir\n/home/phil/src/git/.git\0"
>
> The value can safely contain newlines because it is terminated by
> '\0'. The reason that "git config --list -z" exists is to provide an
> unambiguous output format as config values can contain newlines.

For Lukas's purpose, I presume we are in full control of keys, and
can assume that keys do not have any LF in them, so it is safe to
treat everything after the first LF up to the NUL as its value.  

Similarly, even though "config" allows essentially any byte value in
its second level component name in three component variable names,
we do not allow LF or NUL in it, so we are safe there too.

Thanks.








[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]

  Powered by Linux