Thread (20 messages) flat view 20 messages, 6 authors, 2016-06-15

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

From: Jakub Narebski <hidden>
Date: 2016-06-15 22:43:17

Johannes Schindelin wrote:
As for the FIXME: [...]
Please read original message carefully:
quoted
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help