]> Sergey Matveev's repositories - public-inbox.git/blob - lib/PublicInbox/Import.pm
v2writable: reduce barriers
[public-inbox.git] / lib / PublicInbox / Import.pm
1 # Copyright (C) 2016-2018 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
3 #
4 # git fast-import-based ssoma-mda MDA replacement
5 # This is only ever run by public-inbox-mda and public-inbox-learn,
6 # not the WWW or NNTP code which only requires read-only access.
7 package PublicInbox::Import;
8 use strict;
9 use warnings;
10 use base qw(PublicInbox::Lock);
11 use PublicInbox::Spawn qw(spawn);
12 use PublicInbox::MID qw(mids mid_mime mid2path);
13 use PublicInbox::Address;
14 use PublicInbox::MsgTime qw(msg_timestamp msg_datestamp);
15 use PublicInbox::ContentId qw(content_digest);
16 use PublicInbox::MDA;
17
18 sub new {
19         my ($class, $git, $name, $email, $ibx) = @_;
20         my $ref = 'refs/heads/master';
21         if ($ibx) {
22                 $ref = $ibx->{ref_head} || 'refs/heads/master';
23                 $name ||= $ibx->{name};
24                 $email ||= $ibx->{-primary_address};
25         }
26         bless {
27                 git => $git,
28                 ident => "$name <$email>",
29                 mark => 1,
30                 ref => $ref,
31                 inbox => $ibx,
32                 path_type => '2/38', # or 'v2'
33                 lock_path => "$git->{git_dir}/ssoma.lock", # v2 changes this
34                 bytes_added => 0,
35         }, $class
36 }
37
38 # idempotent start function
39 sub gfi_start {
40         my ($self) = @_;
41
42         return ($self->{in}, $self->{out}) if $self->{pid};
43
44         my ($in_r, $in_w, $out_r, $out_w);
45         pipe($in_r, $in_w) or die "pipe failed: $!";
46         pipe($out_r, $out_w) or die "pipe failed: $!";
47         my $git = $self->{git};
48
49         $self->lock_acquire;
50
51         local $/ = "\n";
52         my $ref = $self->{ref};
53         chomp($self->{tip} = $git->qx(qw(rev-parse --revs-only), $ref));
54         if ($self->{path_type} ne '2/38' && $self->{tip}) {
55                 local $/ = "\0";
56                 my @tree = $git->qx(qw(ls-tree -r -z --name-only), $ref);
57                 chomp @tree;
58                 $self->{-tree} = { map { $_ => 1 } @tree };
59         }
60
61         my $git_dir = $git->{git_dir};
62         my @cmd = ('git', "--git-dir=$git_dir", qw(fast-import
63                         --quiet --done --date-format=raw));
64         my $rdr = { 0 => fileno($out_r), 1 => fileno($in_w) };
65         my $pid = spawn(\@cmd, undef, $rdr);
66         die "spawn fast-import failed: $!" unless defined $pid;
67         $out_w->autoflush(1);
68         $self->{in} = $in_r;
69         $self->{out} = $out_w;
70         $self->{pid} = $pid;
71         $self->{nchg} = 0;
72         binmode $out_w, ':raw' or die "binmode :raw failed: $!";
73         binmode $in_r, ':raw' or die "binmode :raw failed: $!";
74         ($in_r, $out_w);
75 }
76
77 sub wfail () { die "write to fast-import failed: $!" }
78
79 sub now_raw () { time . ' +0000' }
80
81 sub norm_body ($) {
82         my ($mime) = @_;
83         my $b = $mime->body_raw;
84         $b =~ s/(\r?\n)+\z//s;
85         $b
86 }
87
88 # only used for v1 (ssoma) inboxes
89 sub _check_path ($$$$) {
90         my ($r, $w, $tip, $path) = @_;
91         return if $tip eq '';
92         print $w "ls $tip $path\n" or wfail;
93         local $/ = "\n";
94         defined(my $info = <$r>) or die "EOF from fast-import: $!";
95         $info =~ /\Amissing / ? undef : $info;
96 }
97
98 sub _cat_blob ($$$) {
99         my ($r, $w, $oid) = @_;
100         print $w "cat-blob $oid\n" or wfail;
101         local $/ = "\n";
102         my $info = <$r>;
103         defined $info or die "EOF from fast-import / cat-blob: $!";
104         $info =~ /\A[a-f0-9]{40} blob (\d+)\n\z/ or return;
105         my $left = $1;
106         my $offset = 0;
107         my $buf = '';
108         my $n;
109         while ($left > 0) {
110                 $n = read($r, $buf, $left, $offset);
111                 defined($n) or die "read cat-blob failed: $!";
112                 $n == 0 and die 'fast-export (cat-blob) died';
113                 $left -= $n;
114                 $offset += $n;
115         }
116         $n = read($r, my $lf, 1);
117         defined($n) or die "read final byte of cat-blob failed: $!";
118         die "bad read on final byte: <$lf>" if $lf ne "\n";
119         \$buf;
120 }
121
122 sub cat_blob {
123         my ($self, $oid) = @_;
124         my ($r, $w) = $self->gfi_start;
125         _cat_blob($r, $w, $oid);
126 }
127
128 sub check_remove_v1 {
129         my ($r, $w, $tip, $path, $mime) = @_;
130
131         my $info = _check_path($r, $w, $tip, $path) or return ('MISSING',undef);
132         $info =~ m!\A100644 blob ([a-f0-9]{40})\t!s or die "not blob: $info";
133         my $oid = $1;
134         my $msg = _cat_blob($r, $w, $oid) or die "BUG: cat-blob $1 failed";
135         my $cur = PublicInbox::MIME->new($msg);
136         my $cur_s = $cur->header('Subject');
137         $cur_s = '' unless defined $cur_s;
138         my $cur_m = $mime->header('Subject');
139         $cur_m = '' unless defined $cur_m;
140         if ($cur_s ne $cur_m || norm_body($cur) ne norm_body($mime)) {
141                 return ('MISMATCH', $cur);
142         }
143         (undef, $cur);
144 }
145
146 sub checkpoint {
147         my ($self) = @_;
148         return unless $self->{pid};
149         print { $self->{out} } "checkpoint\n" or wfail;
150         undef;
151 }
152
153 sub progress {
154         my ($self, $msg) = @_;
155         return unless $self->{pid};
156         print { $self->{out} } "progress $msg\n" or wfail;
157         $self->{in}->getline eq "progress $msg\n" or die
158                 "progress $msg not received\n";
159         undef;
160 }
161
162 sub _update_git_info ($$) {
163         my ($self, $do_gc) = @_;
164         # for compatibility with existing ssoma installations
165         # we can probably remove this entirely by 2020
166         my $git_dir = $self->{git}->{git_dir};
167         my @cmd = ('git', "--git-dir=$git_dir");
168         my $index = "$git_dir/ssoma.index";
169         if (-e $index && !$ENV{FAST}) {
170                 my $env = { GIT_INDEX_FILE => $index };
171                 run_die([@cmd, qw(read-tree -m -v -i), $self->{ref}], $env);
172         }
173         run_die([@cmd, 'update-server-info'], undef);
174         ($self->{path_type} eq '2/38') and eval {
175                 require PublicInbox::SearchIdx;
176                 my $inbox = $self->{inbox} || $git_dir;
177                 my $s = PublicInbox::SearchIdx->new($inbox);
178                 $s->index_sync({ ref => $self->{ref} });
179         };
180         eval { run_die([@cmd, qw(gc --auto)], undef) } if $do_gc;
181 }
182
183 sub barrier {
184         my ($self) = @_;
185
186         # For safety, we ensure git checkpoint is complete before because
187         # the data in git is still more important than what is in Xapian
188         # in v2.  Performance may be gained by delaying the ->progress
189         # call but we lose safety
190         if ($self->{nchg}) {
191                 $self->checkpoint;
192                 $self->progress('checkpoint');
193                 _update_git_info($self, 0);
194                 $self->{nchg} = 0;
195         }
196 }
197
198 # used for v2
199 sub get_mark {
200         my ($self, $mark) = @_;
201         die "not active\n" unless $self->{pid};
202         my ($r, $w) = $self->gfi_start;
203         print $w "get-mark $mark\n" or wfail;
204         defined(my $oid = <$r>) or die "get-mark failed, need git 2.6.0+\n";
205         chomp($oid);
206         $oid;
207 }
208
209 # returns undef on non-existent
210 # ('MISMATCH', Email::MIME) on mismatch
211 # (:MARK, Email::MIME) on success
212 #
213 # v2 callers should check with Xapian before calling this as
214 # it is not idempotent.
215 sub remove {
216         my ($self, $mime, $msg) = @_; # mime = Email::MIME
217
218         my $path_type = $self->{path_type};
219         my ($path, $err, $cur, $blob);
220
221         my ($r, $w) = $self->gfi_start;
222         my $tip = $self->{tip};
223         if ($path_type eq '2/38') {
224                 $path = mid2path(v1_mid0($mime));
225                 ($err, $cur) = check_remove_v1($r, $w, $tip, $path, $mime);
226                 return ($err, $cur) if $err;
227         } else {
228                 my $sref;
229                 if (ref($mime) eq 'SCALAR') { # optimization used by V2Writable
230                         $sref = $mime;
231                 } else { # XXX should not be necessary:
232                         my $str = $mime->as_string;
233                         $sref = \$str;
234                 }
235                 my $len = length($$sref);
236                 $blob = $self->{mark}++;
237                 print $w "blob\nmark :$blob\ndata $len\n",
238                         $$sref, "\n" or wfail;
239         }
240
241         my $ref = $self->{ref};
242         my $commit = $self->{mark}++;
243         my $parent = $tip =~ /\A:/ ? $tip : undef;
244         unless ($parent) {
245                 print $w "reset $ref\n" or wfail;
246         }
247         my $ident = $self->{ident};
248         my $now = now_raw();
249         $msg ||= 'rm';
250         my $len = length($msg) + 1;
251         print $w "commit $ref\nmark :$commit\n",
252                 "author $ident $now\n",
253                 "committer $ident $now\n",
254                 "data $len\n$msg\n\n",
255                 'from ', ($parent ? $parent : $tip), "\n" or wfail;
256         if (defined $path) {
257                 print $w "D $path\n\n" or wfail;
258         } else {
259                 clean_tree_v2($self, $w, 'd');
260                 print $w "M 100644 :$blob d\n\n" or wfail;
261         }
262         $self->{nchg}++;
263         (($self->{tip} = ":$commit"), $cur);
264 }
265
266 sub git_timestamp {
267         my ($ts, $zone) = @_;
268         $ts = 0 if $ts < 0; # git uses unsigned times
269         "$ts $zone";
270 }
271
272 sub extract_author_info ($) {
273         my ($mime) = @_;
274
275         my $sender = '';
276         my $from = $mime->header('From');
277         my ($email) = PublicInbox::Address::emails($from);
278         my ($name) = PublicInbox::Address::names($from);
279         if (!defined($name) || !defined($email)) {
280                 $sender = $mime->header('Sender');
281                 if (!defined($name)) {
282                         ($name) = PublicInbox::Address::names($sender);
283                 }
284                 if (!defined($email)) {
285                         ($email) = PublicInbox::Address::emails($sender);
286                 }
287         }
288         if (defined $email) {
289                 # quiet down wide character warnings with utf8::encode
290                 utf8::encode($email);
291         } else {
292                 $email = '';
293                 warn "no email in From: $from or Sender: $sender\n";
294         }
295
296         # git gets confused with:
297         #  "'A U Thor <u@example.com>' via foo" <foo@example.com>
298         # ref:
299         # <CAD0k6qSUYANxbjjbE4jTW4EeVwOYgBD=bXkSu=akiYC_CB7Ffw@mail.gmail.com>
300         if (defined $name) {
301                 $name =~ tr/<>//d;
302                 utf8::encode($name);
303         } else {
304                 $name = '';
305                 warn "no name in From: $from or Sender: $sender\n";
306         }
307         ($name, $email);
308 }
309
310 # kill potentially confusing/misleading headers
311 sub drop_unwanted_headers ($) {
312         my ($mime) = @_;
313
314         $mime->header_set($_) for qw(bytes lines content-length status);
315         $mime->header_set($_) for @PublicInbox::MDA::BAD_HEADERS;
316 }
317
318 # used by V2Writable, too
319 sub append_mid ($$) {
320         my ($hdr, $mid0) = @_;
321         # @cur is likely empty if we need to call this sub, but it could
322         # have random unparseable crap which we'll preserve, too.
323         my @cur = $hdr->header_raw('Message-ID');
324         $hdr->header_set('Message-ID', @cur, "<$mid0>");
325 }
326
327 sub v1_mid0 ($) {
328         my ($mime) = @_;
329         my $hdr = $mime->header_obj;
330         my $mids = mids($hdr);
331
332         if (!scalar(@$mids)) { # spam often has no Message-Id
333                 my $mid0 = digest2mid(content_digest($mime));
334                 append_mid($hdr, $mid0);
335                 return $mid0;
336         }
337         $mids->[0];
338 }
339 sub clean_tree_v2 ($$$) {
340         my ($self, $w, $keep) = @_;
341         my $tree = $self->{-tree} or return; #v2 only
342         delete $tree->{$keep};
343         foreach (keys %$tree) {
344                 print $w "D $_\n" or wfail;
345         }
346         %$tree = ($keep => 1);
347 }
348
349 # returns undef on duplicate
350 # returns the :MARK of the most recent commit
351 sub add {
352         my ($self, $mime, $check_cb) = @_; # mime = Email::MIME
353
354         my ($name, $email) = extract_author_info($mime);
355         my $hdr = $mime->header_obj;
356         my @at = msg_datestamp($hdr);
357         my @ct = msg_timestamp($hdr);
358         my $author_time_raw = git_timestamp(@at);
359         my $commit_time_raw = git_timestamp(@ct);
360         my $subject = $mime->header('Subject');
361         $subject = '(no subject)' unless defined $subject;
362         my $path_type = $self->{path_type};
363
364         my $path;
365         if ($path_type eq '2/38') {
366                 $path = mid2path(v1_mid0($mime));
367         } else { # v2 layout, one file:
368                 $path = 'm';
369         }
370
371         my ($r, $w) = $self->gfi_start;
372         my $tip = $self->{tip};
373         if ($path_type eq '2/38') {
374                 _check_path($r, $w, $tip, $path) and return;
375         }
376
377         drop_unwanted_headers($mime);
378
379         # spam check:
380         if ($check_cb) {
381                 $mime = $check_cb->($mime) or return;
382         }
383
384         my $blob = $self->{mark}++;
385         my $str = $mime->as_string;
386         my $n = length($str);
387         $self->{bytes_added} += $n;
388         print $w "blob\nmark :$blob\ndata ", $n, "\n" or wfail;
389         print $w $str, "\n" or wfail;
390
391         # v2: we need this for Xapian
392         if ($self->{want_object_info}) {
393                 my $oid = $self->get_mark(":$blob");
394                 $self->{last_object} = [ $oid, $n, \$str ];
395         }
396         my $ref = $self->{ref};
397         my $commit = $self->{mark}++;
398         my $parent = $tip =~ /\A:/ ? $tip : undef;
399
400         unless ($parent) {
401                 print $w "reset $ref\n" or wfail;
402         }
403
404         utf8::encode($subject);
405         print $w "commit $ref\nmark :$commit\n",
406                 "author $name <$email> $author_time_raw\n",
407                 "committer $self->{ident} $commit_time_raw\n" or wfail;
408         print $w "data ", (length($subject) + 1), "\n",
409                 $subject, "\n\n" or wfail;
410         if ($tip ne '') {
411                 print $w 'from ', ($parent ? $parent : $tip), "\n" or wfail;
412         }
413         clean_tree_v2($self, $w, $path);
414         print $w "M 100644 :$blob $path\n\n" or wfail;
415         $self->{nchg}++;
416         $self->{tip} = ":$commit";
417 }
418
419 sub run_die ($;$$) {
420         my ($cmd, $env, $rdr) = @_;
421         my $pid = spawn($cmd, $env, $rdr);
422         defined $pid or die "spawning ".join(' ', @$cmd)." failed: $!";
423         waitpid($pid, 0) == $pid or die join(' ', @$cmd) .' did not finish';
424         $? == 0 or die join(' ', @$cmd) . " failed: $?\n";
425 }
426
427 sub done {
428         my ($self) = @_;
429         my $w = delete $self->{out} or return;
430         my $r = delete $self->{in} or die 'BUG: missing {in} when done';
431         print $w "done\n" or wfail;
432         my $pid = delete $self->{pid} or die 'BUG: missing {pid} when done';
433         waitpid($pid, 0) == $pid or die 'fast-import did not finish';
434         $? == 0 or die "fast-import failed: $?";
435
436         _update_git_info($self, 1) if delete $self->{nchg};
437
438         $self->lock_release;
439 }
440
441 sub atfork_child {
442         my ($self) = @_;
443         foreach my $f (qw(in out)) {
444                 close $self->{$f} or die "failed to close import[$f]: $!\n";
445         }
446 }
447
448 sub digest2mid ($) {
449         my ($dig) = @_;
450         my $b64 = $dig->clone->b64digest;
451         # Make our own URLs nicer:
452         # See "Base 64 Encoding with URL and Filename Safe Alphabet" in RFC4648
453         $b64 =~ tr!+/=!-_!d;
454
455         # We can make this more meaningful with a date prefix or other things,
456         # but this is only needed for crap that fails to generate a Message-ID
457         # or reuses one.  In other words, it's usually spammers who hit this
458         # so they don't deserve nice Message-IDs :P
459         $b64 . '@localhost';
460 }
461
462 sub clean_purge_buffer {
463         my ($oids, $buf) = @_;
464         my $cmt_msg = 'purged '.join(' ',@$oids)."\n";
465         @$oids = ();
466
467         foreach my $i (0..$#$buf) {
468                 my $l = $buf->[$i];
469                 if ($l =~ /^author .* (\d+ [\+-]?\d+)$/) {
470                         $buf->[$i] = "author <> $1\n";
471                 } elsif ($l =~ /^data (\d+)/) {
472                         $buf->[$i++] = "data " . length($cmt_msg) . "\n";
473                         $buf->[$i] = $cmt_msg;
474                         last;
475                 }
476         }
477 }
478
479 sub purge_oids {
480         my ($self, $purge) = @_;
481         my $tmp = "refs/heads/purge-".((keys %$purge)[0]);
482         my $old = $self->{'ref'};
483         my $git = $self->{git};
484         my @export = (qw(fast-export --no-data --use-done-feature), $old);
485         my ($rd, $pid) = $git->popen(@export);
486         my ($r, $w) = $self->gfi_start;
487         my @buf;
488         my $npurge = 0;
489         my @oids;
490         my ($done, $mark);
491         my $tree = $self->{-tree};
492         while (<$rd>) {
493                 if (/^reset (?:.+)/) {
494                         push @buf, "reset $tmp\n";
495                 } elsif (/^commit (?:.+)/) {
496                         if (@buf) {
497                                 $w->print(@buf) or wfail;
498                                 @buf = ();
499                         }
500                         push @buf, "commit $tmp\n";
501                 } elsif (/^data (\d+)/) {
502                         # only commit message, so $len is small:
503                         my $len = $1; # + 1 for trailing "\n"
504                         push @buf, $_;
505                         my $n = read($rd, my $buf, $len) or die "read: $!";
506                         $len == $n or die "short read ($n < $len)";
507                         push @buf, $buf;
508                 } elsif (/^M 100644 ([a-f0-9]+) (\w+)/) {
509                         my ($oid, $path) = ($1, $2);
510                         if ($purge->{$oid}) {
511                                 push @oids, $oid;
512                                 delete $tree->{$path};
513                         } else {
514                                 $tree->{$path} = 1;
515                                 push @buf, $_;
516                         }
517                 } elsif (/^D (\w+)/) {
518                         my $path = $1;
519                         push @buf, $_ if $tree->{$path};
520                 } elsif ($_ eq "\n") {
521                         if (@oids) {
522                                 my $out = join('', @buf);
523                                 $out =~ s/^/# /sgm;
524                                 warn "purge rewriting\n", $out, "\n";
525                                 clean_purge_buffer(\@oids, \@buf);
526                                 $npurge++;
527                         }
528                         $w->print(@buf, "\n") or wfail;
529                         @buf = ();
530                 } elsif ($_ eq "done\n") {
531                         $done = 1;
532                 } elsif (/^mark :(\d+)$/) {
533                         push @buf, $_;
534                         $mark = $1;
535                 } else {
536                         push @buf, $_;
537                 }
538         }
539         if (@buf) {
540                 $w->print(@buf) or wfail;
541         }
542         die 'done\n not seen from fast-export' unless $done;
543         chomp(my $cmt = $self->get_mark(":$mark")) if $npurge;
544         $self->{nchg} = 0; # prevent _update_git_info until update-ref:
545         $self->done;
546         my @git = ('git', "--git-dir=$git->{git_dir}");
547
548         run_die([@git, qw(update-ref), $old, $tmp]) if $npurge;
549
550         run_die([@git, qw(update-ref -d), $tmp]);
551
552         return if $npurge == 0;
553
554         run_die([@git, qw(-c gc.reflogExpire=now gc --prune=all)]);
555         my $err = 0;
556         foreach my $oid (keys %$purge) {
557                 my @info = $git->check($oid);
558                 if (@info) {
559                         warn "$oid not purged\n";
560                         $err++;
561                 }
562         }
563         _update_git_info($self, 0);
564         die "Failed to purge $err object(s)\n" if $err;
565         $cmt;
566 }
567
568 1;
569 __END__
570 =pod
571
572 =head1 NAME
573
574 PublicInbox::Import - message importer for public-inbox
575
576 =head1 VERSION
577
578 version 1.0
579
580 =head1 SYNOPSYS
581
582         use Email::MIME;
583         use PublicInbox::Git;
584         use PublicInbox::Import;
585
586         chomp(my $git_dir = `git rev-parse --git-dir`);
587         $git_dir or die "GIT_DIR= must be specified\n";
588         my $git = PublicInbox::Git->new($git_dir);
589         my @committer = ('inbox', 'inbox@example.org');
590         my $im = PublicInbox::Import->new($git, @committer);
591
592         # to add a message:
593         my $message = "From: <u\@example.org>\n".
594                 "Subject: test message \n" .
595                 "Date: Thu, 01 Jan 1970 00:00:00 +0000\n" .
596                 "Message-ID: <m\@example.org>\n".
597                 "\ntest message";
598         my $parsed = Email::MIME->new($message);
599         my $ret = $im->add($parsed);
600         if (!defined $ret) {
601                 warn "duplicate: ",
602                         $parsed->header_obj->header_raw('Message-ID'), "\n";
603         } else {
604                 print "imported at mark $ret\n";
605         }
606         $im->done;
607
608         # to remove a message
609         my $junk = Email::MIME->new($message);
610         my ($mark, $orig) = $im->remove($junk);
611         if ($mark eq 'MISSING') {
612                 print "not found\n";
613         } elsif ($mark eq 'MISMATCH') {
614                 print "Message exists but does not match\n\n",
615                         $orig->as_string, "\n",;
616         } else {
617                 print "removed at mark $mark\n\n",
618                         $orig->as_string, "\n";
619         }
620         $im->done;
621
622 =head1 DESCRIPTION
623
624 An importer and remover for public-inboxes which takes L<Email::MIME>
625 messages as input and stores them in a ssoma repository as
626 documented in L<https://ssoma.public-inbox.org/ssoma_repository.txt>,
627 except it does not allow duplicate Message-IDs.
628
629 It requires L<git(1)> and L<git-fast-import(1)> to be installed.
630
631 =head1 METHODS
632
633 =cut
634
635 =head2 new
636
637         my $im = PublicInbox::Import->new($git, @committer);
638
639 Initialize a new PublicInbox::Import object.
640
641 =head2 add
642
643         my $parsed = Email::MIME->new($message);
644         $im->add($parsed);
645
646 Adds a message to to the git repository.  This will acquire
647 C<$GIT_DIR/ssoma.lock> and start L<git-fast-import(1)> if necessary.
648
649 Messages added will not be visible to other processes until L</done>
650 is called, but L</remove> may be called on them.
651
652 =head2 remove
653
654         my $junk = Email::MIME->new($message);
655         my ($code, $orig) = $im->remove($junk);
656
657 Removes a message from the repository.  On success, it returns
658 a ':'-prefixed numeric code representing the git-fast-import
659 mark and the original messages as an Email::MIME object.
660 If the message could not be found, the code is "MISSING"
661 and the original message is undef.  If there is a mismatch where
662 the "Message-ID" is matched but the subject and body do not match,
663 the returned code is "MISMATCH" and the conflicting message
664 is returned as orig.
665
666 =head2 done
667
668 Finalizes the L<git-fast-import(1)> and unlocks the repository.
669 Calling this is required to finalize changes to a repository.
670
671 =head1 SEE ALSO
672
673 L<Email::MIME>
674
675 =head1 CONTACT
676
677 All feedback welcome via plain-text mail to L<mailto:meta@public-inbox.org>
678
679 The mail archives are hosted at L<https://public-inbox.org/meta/>
680
681 =head1 COPYRIGHT
682
683 Copyright (C) 2016 all contributors L<mailto:meta@public-inbox.org>
684
685 License: AGPL-3.0+ L<http://www.gnu.org/licenses/agpl-3.0.txt>
686
687 =cut