]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/InboxWritable.pm
rename {pi_config} fields to {pi_cfg}
[public-inbox.git] / lib / PublicInbox / InboxWritable.pm
index 752f199741ab39233723c19308d527e70e2cdd72..4980904541af7f245c09787d6bea59f8082d64c6 100644 (file)
@@ -102,7 +102,7 @@ sub filter {
                        $im->done;
                }
 
-               my @args = (-inbox => $self);
+               my @args = (ibx => $self);
                # basic line splitting, only
                # Perhaps we can have proper quote splitting one day...
                ($f, @args) = split(/\s+/, $f) if $f =~ /\s+/;
@@ -298,4 +298,25 @@ sub warn_ignore_cb {
        }
 }
 
+# v2+ only
+sub git_dir_n { "$_[0]->{inboxdir}/git/$_[1].git" }
+
+# v2+ only
+sub git_dir_latest {
+       my ($self, $max) = @_;
+       $$max = -1;
+       my $pfx = "$self->{inboxdir}/git";
+       return unless -d $pfx;
+       my $latest;
+       opendir my $dh, $pfx or die "opendir $pfx: $!\n";
+       while (defined(my $git_dir = readdir($dh))) {
+               $git_dir =~ m!\A([0-9]+)\.git\z! or next;
+               if ($1 > $$max) {
+                       $$max = $1;
+                       $latest = "$pfx/$git_dir";
+               }
+       }
+       $latest;
+}
+
 1;