]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/ViewVCS.pm
viewvcs: show "blob $OID" rather than "$OID blob"
[public-inbox.git] / lib / PublicInbox / ViewVCS.pm
index 0a38f9dee7e5d3126264e2013a7dfb4ca58b13be..3b4fa393ed3ff16436db04a0dc3259d62825edbf 100644 (file)
@@ -179,19 +179,19 @@ title="list contemporary emails">$2</a>)
        $_ = qq(<a href="$upfx$_/s/">).shift(@$p).'</a> '.shift(@$pt) for @$P;
        if (@$P == 1) {
                $x = qq{ (<a
-href="$f.patch">patch</a>)\n   parent $P->[0]};
+href="$f.patch">patch</a>)\n   <a href=#parent>parent</a> $P->[0]};
        } elsif (@$P > 1) {
-               $x = qq(\n  parents $P->[0]\n);
+               $x = qq(\n  <a href=#parents>parents</a> $P->[0]\n);
                shift @$P;
                $x .= qq(          $_\n) for @$P;
                chop $x;
        } else {
-               $x = ' (root commit)';
+               $x = ' (<a href=#root_commit>root commit</a>)';
        }
        PublicInbox::WwwStream::html_init($ctx);
        $ctx->zmore(<<EOM);
-<pre>   commit $H$x
-     tree <a href="$upfx$T/s/">$T</a>
+<pre>   <a href=#commit>commit</a> $H$x
+     <a href=#tree>tree</a> <a href="$upfx$T/s/">$T</a>
    author $au
 committer $co
 
@@ -238,7 +238,24 @@ id=related><pre>find related emails, including ancestors/descendants/conflicts
 EOM
                }
        }
-       $x = $ctx->zflush($ctx->_html_end);
+       chop($x = <<EOM);
+<hr><pre>glossary
+--------
+<dfn
+id=commit>Commit</dfn> objects reference one tree, and zero or more parents.
+
+Single <dfn
+id=parent>parent</dfn> commits can typically generate a patch in
+unified diff format via `git format-patch'.
+
+Multiple <dfn id=parents>parents</dfn> means the commit is a merge.
+
+<dfn id=root_commit>Root commits</dfn> have no ancestor.  Note that it is
+possible to have multiple root commits when merging independent histories.
+
+Every commit references one top-level <dfn id=tree>tree</dfn> object.</pre>
+EOM
+       $x = $ctx->zflush($x, $ctx->_html_end);
        my $res_hdr = delete $ctx->{-res_hdr};
        push @$res_hdr, 'Content-Length', length($x);
        delete($ctx->{env}->{'qspawn.wcb'})->([200, $res_hdr, [$x]]);
@@ -398,7 +415,7 @@ sub solve_result {
                return stream_large_blob($ctx, $res) if defined $ctx->{fn};
                return html_page($ctx, 200, <<EOM . dbg_log($ctx));
 <pre><b>Too big to show, download available</b>
-"$oid $type $size bytes $raw_link</pre>
+blob $oid $size bytes $raw_link</pre>
 EOM
        }
 
@@ -417,7 +434,7 @@ EOM
        }
 
        $bin and return html_page($ctx, 200,
-                               "<pre>$oid $type $size bytes (binary)" .
+                               "<pre>blob $oid $size bytes (binary)" .
                                " $raw_link</pre>".dbg_log($ctx));
 
        # TODO: detect + convert to ensure validity
@@ -433,7 +450,7 @@ EOM
                $$blob = ascii_html($$blob);
        }
 
-       my $x = "<pre>$oid $type $size bytes $raw_link</pre>" .
+       my $x = "<pre>blob $oid $size bytes $raw_link</pre>" .
                "<hr /><table\nclass=blob>".
                "<tr><td\nclass=linenumbers><pre>";
        $x .= sprintf("<a id=n$_ href=#n$_>% ${pad}u</a>\n", $_) for (1..$nl);