about summary refs log tree commit homepage
path: root/lib/PublicInbox
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2019-09-28 20:59:30 +0000
committerEric Wong <e@80x24.org>2019-09-30 05:55:36 +0000
commita722d9aa28c19d82b74ccde6d94e6bdde9917f0c (patch)
tree778dfa4fb72fbdf20d7bf172c2998353eb2fa836 /lib/PublicInbox
parent2fc42236f72ad16a33288f58086edc95da56c612 (diff)
downloadpublic-inbox-a722d9aa28c19d82b74ccde6d94e6bdde9917f0c.tar.gz
This allows us to deal with newlines in config values,
since git-config(1) acquired "-z" support in git v1.5.3.

I'm not sure if it's actually useful in our case, but
maybe some multi-line texts could be added.  And newlines
in path names are super useful!
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r--lib/PublicInbox/Config.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/Config.pm b/lib/PublicInbox/Config.pm
index ef277c40..4fcb20d2 100644
--- a/lib/PublicInbox/Config.pm
+++ b/lib/PublicInbox/Config.pm
@@ -151,14 +151,14 @@ sub git_config_dump {
         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}) {