Subject: Re: [PATCH/RFC] config: Add --null/-z option for null-delimted output

From: Jakub Narebski <[email-masked]>
Date: Tue, 19 Jun 2007 03:16:32 +0200

Johannes Schindelin wrote:

> As for the FIXME: [...]

Please read original message carefully:

>>  Note the FIXME. Does anyone remember the reason why --get-regexp
>>  and --list use different output format?

I think the FIXME is for --get-regexp. And was added by the patch.

> If you have a config like this: 
> 
>         [core]
>                 Some = where
>                 over
>                 the = core.rainbow
> 
> git-config -z would output something like this:
> 
>         core.some\0where\0core.over\0core.the\0core.rainbow\0
> 
> Right?

False. Delim is different from term. You would get

	core.some\nwhere\0core.over\0core.the\ncore.rainbow\0

> As you can see, it is quite hard for a parser to find out what is
> key, and what is value.

	local $/ = "\0";

	while (my $line = <$fd>) {
		chomp $line;
		my ($key, $value) = split(/\n/, $line, 2);

		push @{$config{$key}}, $value if defined $key;
	}

-- 
Jakub Narebski
Poland