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

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

 



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

  Powered by Linux