lib/PublicInbox/Inbox.pm | 18 +++++++++---------
lib/PublicInbox/WWW.pm | 12 ++++++------
lib/PublicInbox/WwwListing.pm | 2 +-
lib/PublicInbox/WwwStream.pm | 12 ++++++------
t/view.t | 2 +-
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 10f716ca6d033b0aecaa7df8a37563997db7c368..c0eb640f14f2630eb314e148bb33cc4ca47f53f0 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -125,11 +125,11 @@ }
bless $opts, $class;
}
-sub git_part {
- my ($self, $part) = @_;
+sub git_epoch {
+ my ($self, $epoch) = @_;
($self->{version} || 1) == 2 or return;
- $self->{"$part.git"} ||= eval {
- my $git_dir = "$self->{mainrepo}/git/$part.git";
+ $self->{"$epoch.git"} ||= eval {
+ my $git_dir = "$self->{mainrepo}/git/$epoch.git";
my $g = PublicInbox::Git->new($git_dir);
$g->{-httpbackend_limiter} = $self->{-httpbackend_limiter};
# no cleanup needed, we never cat-file off this, only clone
@@ -149,13 +149,13 @@ $g;
};
}
-sub max_git_part {
+sub max_git_epoch {
my ($self) = @_;
my $v = $self->{version};
return unless defined($v) && $v == 2;
- my $part = $self->{-max_git_part};
+ my $cur = $self->{-max_git_epoch};
my $changed = git($self)->alternates_changed;
- if (!defined($part) || $changed) {
+ if (!defined($cur) || $changed) {
$self->git->cleanup if $changed;
my $gits = "$self->{mainrepo}/git";
if (opendir my $dh, $gits) {
@@ -164,12 +164,12 @@ while (defined(my $git_dir = readdir($dh))) {
$git_dir =~ m!\A([0-9]+)\.git\z! or next;
$max = $1 if $1 > $max;
}
- $part = $self->{-max_git_part} = $max if $max >= 0;
+ $cur = $self->{-max_git_epoch} = $max if $max >= 0;
} else {
warn "opendir $gits failed: $!\n";
}
}
- $part;
+ $cur;
}
sub mm {
diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index e468263699bbcdd13af2e8efeb020f743b06907b..9021cb528e5f8da398e28d79c6ee7bbae787566b 100644
--- a/lib/PublicInbox/WWW.pm
+++ b/lib/PublicInbox/WWW.pm
@@ -76,9 +76,9 @@
if ($method eq 'POST') {
if ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
(git-upload-pack)\z!x) {
- my ($part, $path) = ($2, $3);
+ my ($epoch, $path) = ($2, $3);
return invalid_inbox($ctx, $1) ||
- serve_git($ctx, $part, $path);
+ serve_git($ctx, $epoch, $path);
} elsif ($path_info =~ m!$INBOX_RE/!o) {
return invalid_inbox($ctx, $1) || mbox_results($ctx);
}
@@ -100,8 +100,8 @@ } elsif ($path_info =~ m!$INBOX_RE/new\.html\z!o) {
invalid_inbox($ctx, $1) || get_new($ctx);
} elsif ($path_info =~ m!$INBOX_RE/(?:(?:git/)?([0-9]+)(?:\.git)?/)?
($PublicInbox::GitHTTPBackend::ANY)\z!ox) {
- my ($part, $path) = ($2, $3);
- invalid_inbox($ctx, $1) || serve_git($ctx, $part, $path);
+ my ($epoch, $path) = ($2, $3);
+ invalid_inbox($ctx, $1) || serve_git($ctx, $epoch, $path);
} elsif ($path_info =~ m!$INBOX_RE/([a-zA-Z0-9_\-]+).mbox\.gz\z!o) {
serve_mbox_range($ctx, $1, $2);
} elsif ($path_info =~ m!$INBOX_RE/$MID_RE/$END_RE\z!o) {
@@ -437,10 +437,10 @@ r404($ctx);
}
sub serve_git {
- my ($ctx, $part, $path) = @_;
+ my ($ctx, $epoch, $path) = @_;
my $env = $ctx->{env};
my $ibx = $ctx->{-inbox};
- my $git = defined $part ? $ibx->git_part($part) : $ibx->git;
+ my $git = defined $epoch ? $ibx->git_epoch($epoch) : $ibx->git;
$git ? PublicInbox::GitHTTPBackend::serve($env, $git, $path) : r404();
}
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index e2724cc49e631dc63a38dc26410d0b6a9577707b..e052bbffa938ec04f0946c09b109b7df903855e3 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -190,7 +190,7 @@ eval { require IO::Compress::Gzip } or return [ 404, [], [] ];
my $manifest = { -abs2urlpath => {}, -mtime => 0 };
for my $ibx (@$list) {
- if (defined(my $max = $ibx->max_git_part)) {
+ if (defined(my $max = $ibx->max_git_epoch)) {
for my $epoch (0..$max) {
manifest_add($manifest, $ibx, $epoch);
}
diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm
index f6c504966e5b037413faf053a8777f84353d0250..082e5ec9caf3b3466efe96ae0439d81a05a4a4db 100644
--- a/lib/PublicInbox/WwwStream.pm
+++ b/lib/PublicInbox/WwwStream.pm
@@ -85,11 +85,11 @@
my (%seen, @urls);
my $http = $ibx->base_url($ctx->{env});
chop $http; # no trailing slash for clone
- my $part = $ibx->max_git_part;
+ my $max = $ibx->max_git_epoch;
my $dir = (split(m!/!, $http))[-1];
- if (defined($part)) { # v2
+ if (defined($max)) { # v2
$seen{$http} = 1;
- for my $i (0..$part) {
+ for my $i (0..$max) {
# old parts my be deleted:
-d "$ibx->{mainrepo}/git/$i.git" or next;
my $url = "$http/$i";
@@ -101,7 +101,7 @@ $seen{$http} = 1;
push @urls, $http;
}
- # FIXME: partitioning in can be different in other repositories,
+ # FIXME: epoch splits can be different in other repositories,
# use the "cloneurl" file as-is for now:
foreach my $u (@{$ibx->cloneurl}) {
next if $seen{$u};
@@ -109,13 +109,13 @@ $seen{$u} = 1;
push @urls, $u =~ /\Ahttps?:/ ? qq($u) : $u;
}
- if (defined($part) || scalar(@urls) > 1) {
+ if (defined($max) || scalar(@urls) > 1) {
$urls .= "\n" .
join("\n", map { "\tgit clone --mirror $_" } @urls);
} else {
$urls .= " git clone --mirror $urls[0]";
}
- if (defined $part) {
+ if (defined $max) {
my $addrs = $ibx->{address};
$addrs = join(' ', @$addrs) if ref($addrs) eq 'ARRAY';
$urls .= < sub { undef },
base_url => sub { 'http://example.com/' },
cloneurl => sub {[]},
nntp_url => sub {[]},
- max_git_part => sub { undef },
+ max_git_epoch => sub { undef },
description => sub { '' }),
www => Plack::Util::inline_object(style => sub { '' }),
};