X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FInboxWritable.pm;h=4980904541af7f245c09787d6bea59f8082d64c6;hb=0d38f65c490466837ae091afa7a7b6f59d04ce7c;hp=752f199741ab39233723c19308d527e70e2cdd72;hpb=11c4929d7ee08b4174918fd9e3d10e10636a054c;p=public-inbox.git diff --git a/lib/PublicInbox/InboxWritable.pm b/lib/PublicInbox/InboxWritable.pm index 752f1997..49809045 100644 --- a/lib/PublicInbox/InboxWritable.pm +++ b/lib/PublicInbox/InboxWritable.pm @@ -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;