my ($file) = @_;
my (%section_seen, @section_order);
return {} unless -e $file;
- my @cmd = (qw/git config/, "--file=$file", '-l');
+ my @cmd = (qw/git config -z -l/, "--file=$file");
my $cmd = join(' ', @cmd);
my $fh = popen_rd(\@cmd) or die "popen_rd failed for $file: $!\n";
my %rv;
- local $/ = "\n";
+ local $/ = "\0";
while (defined(my $line = <$fh>)) {
chomp $line;
- my ($k, $v) = split(/=/, $line, 2);
+ my ($k, $v) = split(/\n/, $line, 2);
my ($section) = ($k =~ /\A(\S+)\.[^\.]+\z/);
unless (defined $section_seen{$section}) {
{
is(system(qw(git init -q --bare), $tmpdir), 0, "git init successful");
- my @cmd = ('git', "--git-dir=$tmpdir", qw(config foo.bar hihi));
+ my @cmd = ('git', "--git-dir=$tmpdir", qw(config foo.bar), "hi\nhi");
is(system(@cmd), 0, "set config");
my $tmp = PublicInbox::Config->new("$tmpdir/config");
- is("hihi", $tmp->{"foo.bar"}, "config read correctly");
+ is("hi\nhi", $tmp->{"foo.bar"}, "config read correctly");
is("true", $tmp->{"core.bare"}, "used --bare repo");
}