]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Import.pm
config: lazy-load coderepos, support extindex
[public-inbox.git] / lib / PublicInbox / Import.pm
index 8a06a661654b861975efbd88cc0df7fdcb010122..b8fa5c217ed99b344019e423cd4a384e6f5bd38c 100644 (file)
@@ -21,9 +21,10 @@ use POSIX qw(strftime);
 
 sub default_branch () {
        state $default_branch = do {
-               delete local $ENV{GIT_CONFIG};
-               my $r = popen_rd([qw(git config --global init.defaultBranch)]);
+               my $r = popen_rd([qw(git config --global init.defaultBranch)],
+                                { GIT_CONFIG => undef });
                chomp(my $h = <$r> // '');
+               close $r;
                $h eq '' ? 'refs/heads/master' : $h;
        }
 }
@@ -67,11 +68,9 @@ sub gfi_start {
                chomp($self->{tip} = $git->qx(qw(rev-parse --revs-only), $ref));
                die "fatal: rev-parse --revs-only $ref: \$?=$?" if $?;
                if ($self->{path_type} ne '2/38' && $self->{tip}) {
-                       local $/ = "\0";
-                       my @t = $git->qx(qw(ls-tree -r -z --name-only), $ref);
+                       my $t = $git->qx(qw(ls-tree -r -z --name-only), $ref);
                        die "fatal: ls-tree -r -z --name-only $ref: \$?=$?" if $?;
-                       chomp @t;
-                       $self->{-tree} = { map { $_ => 1 } @t };
+                       $self->{-tree} = { map { $_ => 1 } split(/\0/, $t) };
                }
                $in_r = $self->{in} = $git->popen(qw(fast-import
                                        --quiet --done --date-format=raw),