diff options
author | Eric Wong <e@80x24.org> | 2021-02-23 03:38:21 +0600 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-02-24 11:12:56 +0000 |
commit | e01fe4f05196b56775fffffe23572ec648b14ec6 (patch) | |
tree | ba6fec8fcfe4e0bdabd45471131f33e1e557c6f2 /lib | |
parent | a5af0bd94dc0504ec34d49199eb2b7d39ceb8557 (diff) | |
download | public-inbox-e01fe4f05196b56775fffffe23572ec648b14ec6.tar.gz |
Apparently this feature is only in Perl 5.12+, and we're still on Perl 5.10.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/PublicInbox/ExtSearchIdx.pm | 3 | ||||
-rw-r--r-- | lib/PublicInbox/Import.pm | 4 | ||||
-rw-r--r-- | lib/PublicInbox/LEI.pm | 6 | ||||
-rw-r--r-- | lib/PublicInbox/Spawn.pm | 5 | ||||
-rw-r--r-- | lib/PublicInbox/TestCommon.pm | 9 |
5 files changed, 13 insertions, 14 deletions
diff --git a/lib/PublicInbox/ExtSearchIdx.pm b/lib/PublicInbox/ExtSearchIdx.pm index a4b3bbd5..d0c9c2f7 100644 --- a/lib/PublicInbox/ExtSearchIdx.pm +++ b/lib/PublicInbox/ExtSearchIdx.pm @@ -1011,8 +1011,9 @@ sub _watch_commit { # PublicInbox::DS::add_timer callback delete $self->{-commit_timer}; eidxq_process($self, $self->{-watch_sync}); eidxq_release($self); - delete local $self->{-watch_sync}->{-regen_fmt}; + my $fmt = delete $self->{-watch_sync}->{-regen_fmt}; reindex_checkpoint($self, $self->{-watch_sync}); + $self->{-watch_sync}->{-regen_fmt} = $fmt; # call event_step => done unless commit_timer is armed PublicInbox::DS::requeue($self); diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm index e803ee74..b8fa5c21 100644 --- a/lib/PublicInbox/Import.pm +++ b/lib/PublicInbox/Import.pm @@ -21,8 +21,8 @@ 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; diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index fec00c02..28e5365a 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -641,13 +641,11 @@ sub lei_mark { sub _config { my ($self, @argv) = @_; - my $env = $self->{env}; - delete local $env->{GIT_CONFIG}; - delete local $ENV{GIT_CONFIG}; + my %env = (%{$self->{env}}, GIT_CONFIG => undef); my $cfg = _lei_cfg($self, 1); my $cmd = [ qw(git config -f), $cfg->{'-f'}, @argv ]; my %rdr = map { $_ => $self->{$_} } (0..2); - waitpid(spawn($cmd, $env, \%rdr), 0); + waitpid(spawn($cmd, \%env, \%rdr), 0); } sub lei_config { diff --git a/lib/PublicInbox/Spawn.pm b/lib/PublicInbox/Spawn.pm index 00e6829e..fe7aa0a8 100644 --- a/lib/PublicInbox/Spawn.pm +++ b/lib/PublicInbox/Spawn.pm @@ -358,10 +358,9 @@ sub spawn ($;$$) { my $f = which($cmd->[0]) // die "$cmd->[0]: command not found\n"; my @env; $opts ||= {}; - - my %env = $env ? (%ENV, %$env) : %ENV; + my %env = (%ENV, $env ? %$env : ()); while (my ($k, $v) = each %env) { - push @env, "$k=$v"; + push @env, "$k=$v" if defined($v); } my $redir = []; for my $child_fd (0..2) { diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index ca05fa21..fc32b57f 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -483,10 +483,11 @@ SKIP: { require_git(2.6, 1) or skip('git 2.6+ required for lei test', 2); require_mods(qw(json DBD::SQLite Search::Xapian), 2); require PublicInbox::Config; - delete local $ENV{XDG_DATA_HOME}; - delete local $ENV{XDG_CONFIG_HOME}; - local $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com'; - local $ENV{GIT_COMMITTER_NAME} = 'lei user'; + local %ENV = %ENV; + delete $ENV{XDG_DATA_HOME}; + delete $ENV{XDG_CONFIG_HOME}; + $ENV{GIT_COMMITTER_EMAIL} = 'lei@example.com'; + $ENV{GIT_COMMITTER_NAME} = 'lei user'; my (undef, $fn, $lineno) = caller(0); my $t = "$fn:$lineno"; require PublicInbox::Spawn; |