diff options
author | Eric Wong <e@80x24.org> | 2019-12-25 07:50:40 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-12-26 10:48:19 +0000 |
commit | e0e53f21b15d40841f184f22223896cf7cf0b8d8 (patch) | |
tree | b295e0c32dad60801300379da96d4342218def30 /lib/PublicInbox/SolverGit.pm | |
parent | dd57a7d007bf756d856fe3d2b414657ebf009941 (diff) | |
download | public-inbox-e0e53f21b15d40841f184f22223896cf7cf0b8d8.tar.gz |
And remove the last anonymous sub in SolverGit itself.
Diffstat (limited to 'lib/PublicInbox/SolverGit.pm')
-rw-r--r-- | lib/PublicInbox/SolverGit.pm | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/PublicInbox/SolverGit.pm b/lib/PublicInbox/SolverGit.pm index fd43940f..9266fb08 100644 --- a/lib/PublicInbox/SolverGit.pm +++ b/lib/PublicInbox/SolverGit.pm @@ -93,8 +93,9 @@ sub solve_existing ($$) { scalar(@ambiguous) ? \@ambiguous : undef; } -sub extract_diff ($$$$$) { - my ($self, $p, $re, $ibx, $smsg) = @_; +sub extract_diff ($$) { + my ($p, $arg) = @_; + my ($self, $diffs, $re, $ibx, $smsg) = @$arg; my ($part) = @$p; # ignore $depth and @idx; my $hdr_lines; # diff --git a/... b/... my $tmp; @@ -170,7 +171,7 @@ sub extract_diff ($$$$$) { } return undef unless $tmp; close $tmp or die "close(tmp): $!"; - $di; + push @$diffs, $di; } sub path_searchable ($) { defined($_[0]) && $_[0] =~ m!\A[\w/\. \-]+\z! } @@ -209,16 +210,14 @@ sub find_extract_diffs ($$$) { my $msgs = $srch->query($q, { relevance => 1 }); my $re = qr/\Aindex ($pre[a-f0-9]*)\.\.($post[a-f0-9]*)(?: ([0-9]+))?/; - - my @di; + my $diffs = []; foreach my $smsg (@$msgs) { $ibx->smsg_mime($smsg) or next; - msg_iter(delete($smsg->{mime}), sub { - my $di = extract_diff($self, $_[0], $re, $ibx, $smsg); - push @di, $di if defined($di); - }); + my $mime = delete $smsg->{mime}; + msg_iter($mime, \&extract_diff, + [$self, $diffs, $re, $ibx, $smsg]); } - @di ? \@di : undef; + @$diffs ? $diffs : undef; } sub update_index_result ($$) { |