X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=public-inbox-mda;h=24feeb81d355a8d4f188a5d7ea4bafa33c66f07a;hb=65ff86f333a1f8276943248efef7fa2a64afe9e3;hp=df8ca38c13ff3d93d59765e0dd5751dc45d599ee;hpb=9bc8cf2e9866393470cdb76a2af39d63f4246204;p=public-inbox.git diff --git a/public-inbox-mda b/public-inbox-mda index df8ca38c..24feeb81 100755 --- a/public-inbox-mda +++ b/public-inbox-mda @@ -1,6 +1,8 @@ #!/usr/bin/perl -w # Copyright (C) 2013-2015 all contributors # License: AGPLv3 or later (https://www.gnu.org/licenses/agpl-3.0.txt) +# +# Mail delivery agent for public-inbox, run from your MTA upon mail delivery use strict; use warnings; my $usage = 'public-inbox-mda < rfc2822_message'; @@ -60,7 +62,7 @@ if (PublicInbox::MDA->precheck($filter, $dst->{address}) && PublicInbox::MDA->author_info($msg); END { - search_index_sync($main_repo) if ($? == 0); + index_sync($main_repo) if ($? == 0); }; local $ENV{GIT_AUTHOR_NAME} = $name; @@ -96,8 +98,12 @@ sub do_spamc { return ($@ || $? || !defined($$out) || $$out eq '') ? 0 : 1; } -sub search_index_sync { +sub index_sync { my ($git_dir) = @_; + + # potentially user-visible, ignore errors: + system('git', "--git-dir=$git_dir", 'update-server-info'); + eval { require PublicInbox::SearchIdx; PublicInbox::SearchIdx->new($git_dir, 2)->index_sync;