]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/WwwListing.pm
wwwlisting: fix spelling and clarify sub location
[public-inbox.git] / lib / PublicInbox / WwwListing.pm
index 690976acdc9ae2a6f9afb811c69e3d3fec041c35..03534f03e670c6b92e5da18ab4975984fe88a6ed 100644 (file)
@@ -96,7 +96,7 @@ sub html ($$) {
                $title .= ' - listing';
                $code = 200;
 
-               # Swartzian transform since ->modified is expensive
+               # Schwartzian transform since Inbox->modified is expensive
                @$list = sort {
                        $b->[0] <=> $a->[0]
                } map { [ $_->modified, $_ ] } @$list;
@@ -138,13 +138,13 @@ sub fingerprint ($) {
        $dig->hexdigest;
 }
 
-sub manifest_add ($$;$) {
-       my ($manifest, $ibx, $epoch) = @_;
+sub manifest_add ($$;$$) {
+       my ($manifest, $ibx, $epoch, $default_desc) = @_;
        my $url_path = "/$ibx->{name}";
-       my $git_dir = $ibx->{mainrepo};
+       my $git_dir = $ibx->{inboxdir};
        if (defined $epoch) {
                $git_dir .= "/git/$epoch.git";
-               $url_path .= "/$epoch";
+               $url_path .= "/git/$epoch.git";
        }
        return unless -d $git_dir;
        my $git = PublicInbox::Git->new($git_dir);
@@ -155,6 +155,13 @@ sub manifest_add ($$;$) {
        $owner = undef if $owner eq '';
        $desc = 'Unnamed repository' if $desc eq '';
 
+       # templates/hooks--update.sample and git-multimail in git.git
+       # only match "Unnamed repository", not the full contents of
+       # templates/this--description in git.git
+       if ($desc =~ /\AUnnamed repository/) {
+               $desc = "$default_desc [epoch $epoch]" if defined($epoch);
+       }
+
        my $reference;
        chomp(my $alt = try_cat("$git_dir/objects/info/alternates"));
        if ($alt) {
@@ -190,9 +197,10 @@ sub js ($$) {
 
        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)) {
+                       my $desc = $ibx->description;
                        for my $epoch (0..$max) {
-                               manifest_add($manifest, $ibx, $epoch);
+                               manifest_add($manifest, $ibx, $epoch, $desc);
                        }
                } else {
                        manifest_add($manifest, $ibx);