G'day.I figured you folks might be interested in a number of modifications the XMMS2 team have made to gitweb. All the changes can be seen at http://git.xmms.se
1) Navbar refactoring (gitweb-xmms2navbar.diff)The original idea was to add a link to our snapshots directory, in the navigation bar at the top of every gitweb page. The problem was that the code for producing the navbar HTML was mostly duplicated in various different places. I refactored the code so that a single 'git_navbar' subroutine is called every time gitweb needs a navbar. The patch itself probably needs some cleaning up: 1) I omitted the git_navbar call in one place, as the original navbar code there didn't look like the navbar code in other places, 2) there's a 'snapshot link' in the navbar which won't work unless gitweb-xmms2snapshots.diff is also applied ($snapshots_url isn't defined in gitweb-xmms2navbar.diff)
2) Commit tags support (gitweb-xmms2committags.diff)We originally started using specific commit tags during the development of XMMS2 to facilitate the generation of changelogs at every release. This patch reformats commit descriptions containing 'BUG' or 'FEATURE' to produce hyperlinks to bug reports on our mantis bug tracker (http://bugs.xmms2.xmms.se), as well as linking to release information pages ('RELEASE' tag). You could adapt this patch to provide support for other custom tags. It might also be possible to cleverly integrate the committags and committags_shortlog subroutines into a single subroutine.. I couldn't figure it out easily enough - my Perl(+regexp)-fu isn't strong enough. ;)
3) Snapshot integration (gitweb-xmms2snapshots.diff & snapshot.cgi)This patch makes it possible to easily produce snapshots of every commit in a git tree. Hyperlinks to 'snapshot' or 'latest snapshot' are added in various places. All you need is to have a CGI script to handle the request, with 'tree' and 'commit' parameters, where 'tree' refers to a git tree/repository and 'commit' is either a commit hash or 'HEAD'. I'm also attaching snapshot.cgi, the Python script we use to automagically generate and serve snapshot tarballs, as reference.
Hope someone finds these useful.. ;) Cheers -S
--- ../gitweb/gitweb.cgi 2005-08-25 19:25:11.000000000 +0800 +++ gitweb.cgi 2005-08-25 20:33:50.000000000 +0800 @@ -40,6 +40,23 @@ #my $projects_list = $projectroot; my $projects_list = "index/index.aux"; +# custom stuff - mantis/commit tags integration +sub committags($){ + my $a = shift; + $a =~ s!BUG\(([0-9]*)\)!<a href="http://bugs.xmms2.xmms.se/view.php?id=$1">BUG($1)</a>!g; + $a =~ s!FEATURE\(([0-9]*)\)!<a href="http://bugs.xmms2.xmms.se/view.php?id=$1">FEATURE($1)</a>!g; + $a =~ s!RELEASE: (.*)!RELEASE: <a href="http://wiki.xmms2.xmms.se/index.php/Release:$1">$1</a>!g; + return $a; +} +sub committags_shortlog($$){ + my $a = shift; + my $href = shift; + $a =~ s!BUG\(([0-9]*)\)!</a><a href="http://bugs.xmms2.xmms.se/view.php?id=$1">BUG($1)</a><a class=\"list\" href=\"$href\">!g; + $a =~ s!FEATURE\(([0-9]*)\)!</a><a href="http://bugs.xmms2.xmms.se/view.php?id=$1">FEATURE($1)</a><a class=\"list\" href=\"$href\">!g; + $a =~ s!RELEASE: (.*)!RELEASE: <a href="http://wiki.xmms2.xmms.se/index.php/Release:$1">$1</a>!g; + return $a; +} + # input validation and dispatch my $action = $cgi->param('a'); if (defined $action) { @@ -655,7 +672,7 @@ $line =~ s/$hash_text/$link/; } } - return $line; + return committags($line); } sub date_str { @@ -979,7 +996,7 @@ "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" . "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, - "<b>" . escapeHTML($co{'title_short'}) . "</b>") . + "<b>" . committags_shortlog(escapeHTML($co{'title_short'}), "$my_uri?p=$project;a=commit;h=$commit") . "</b>") . "</td>\n" . "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . @@ -1977,7 +1994,7 @@ "<br/><br/>\n" . "</div>\n"; print "<div>\n" . - $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . + $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, committags(escapeHTML($co{'title'}))) . "\n" . "</div>\n"; print "<div class=\"page_path\"><b>/$file_name</b><br/></div>\n"; @@ -2004,7 +2021,7 @@ print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" . "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" . "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" . - escapeHTML(chop_str($co{'title'}, 50)) . "</b>") . "</td>\n" . + committags(escapeHTML(chop_str($co{'title'}, 50))) . "</b>") . "</td>\n" . "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=blob;hb=$commit;f=$file_name"}, "blob"); @@ -2230,7 +2247,7 @@ print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" . "<td><i>" . escapeHTML(chop_str($co{'author_name'}, 10)) . "</i></td>\n" . "<td>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit", -class => "list"}, "<b>" . - escapeHTML($co{'title_short'}) . "</b>") . "</td>\n" . + committags_shortlog(escapeHTML($co{'title_short'}), "$my_uri?p=$project;a=commit;h=$commit") . "</b>") . "</td>\n" . "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") .
--- ../gitweb/gitweb.cgi 2005-08-25 19:25:11.000000000 +0800 +++ gitweb.cgi 2005-08-26 17:56:41.000000000 +0800 @@ -40,6 +40,53 @@ #my $projects_list = $projectroot; my $projects_list = "index/index.aux"; +# custom stuff - refactored navbar +sub git_navbar($$$$) { + my $project = shift; + my $head = shift; + my $curSection = shift; + my $extraLinks = shift; + + my $sumLink = $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary"); + my $slogLink = $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog"); + my $logLink = $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log"); + my $comLink = $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit"); + my $comdifLink = $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff"); + my $treeLink = $cgi->a({-href => "$my_uri?p=$project;a=tree"}, "tree"); + my $snapLink = $cgi->a({-href => "$snapshots_url?tree=$project&commit=HEAD"}, "latest snapshot"); + + if ($curSection eq "summary") { + $sumLink = "summary"; + } + elsif ($curSection eq "shortlog") { + $slogLink = "shortlog"; + } + elsif ($curSection eq "log") { + $logLink = "log"; + } + elsif ($curSection eq "commit") { + $comLink = "commit"; + } + elsif ($curSection eq "commitdiff") { + $comdifLink = "commitdiff"; + } + elsif ($curSection eq "tree") { + $treeLink = "tree"; + } + + my $retVal = "<div class=\"page_nav\">\n" . + $sumLink . + " | " . $slogLink . + " | " . $logLink . + " | " . $comLink . + " | " . $comdifLink . + " | " . $treeLink . + " | " . $snapLink . + "<br/>$extraLinks<br/>\n" . + "</div>\n"; + return $retVal; +} + # input validation and dispatch my $action = $cgi->param('a'); if (defined $action) { @@ -941,15 +988,7 @@ } git_header_html(); - print "<div class=\"page_nav\">\n" . - "summary". - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree"}, "tree") . - "<br/><br/>\n" . - "</div>\n"; + print git_navbar($project, $head, "summary", ""); print "<div class=\"title\"> </div>\n"; print "<table cellspacing=\"0\">\n" . "<tr><td>description</td><td>" . escapeHTML($descr) . "</td></tr>\n" . @@ -1087,15 +1126,7 @@ sub git_tag { my $head = git_read_hash("$project/HEAD"); git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "tree") . "<br/>\n" . - "<br/>\n" . - "</div>\n"; + print git_navbar($project, $head, "tag", ""); my %tag = git_read_tag($hash); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($tag{'name'})) . "\n" . @@ -1126,15 +1157,7 @@ sub git_tags { my $head = git_read_hash("$project/HEAD"); git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "tree") . "<br/>\n" . - "<br/>\n" . - "</div>\n"; + print git_navbar($project, $head, "tags", ""); my $taglist = git_read_refs("refs/tags"); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . @@ -1185,15 +1208,7 @@ sub git_branches { my $head = git_read_hash("$project/HEAD"); git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$head"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$head"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;hb=$head"}, "tree") . "<br/>\n" . - "<br/>\n" . - "</div>\n"; + print git_navbar($project, $head, "branches", ""); my $taglist = git_read_refs("refs/heads"); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . @@ -1263,15 +1278,7 @@ my $base = $file_name || ""; git_header_html(); if (defined $hash_base && (my %co = git_read_commit($hash_base))) { - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree") . "<br/>\n"; - print $cgi->a({-href => "$my_uri?p=$project;a=blob_plain;h=$hash"}, "plain") . "<br/>\n" . - "</div>\n"; + print git_navbar($project, $hash_base, "blob", $cgi->a({-href => "$my_uri?p=$project;a=blob_plain;h=$hash"}, "plain")); print "<div>" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "</div>\n"; @@ -1331,15 +1338,7 @@ my $base = ""; if (defined $hash_base && (my %co = git_read_commit($hash_base))) { $base_key = ";hb=$hash_base"; - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash_base"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash_base"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") . - " | tree" . - "<br/><br/>\n" . - "</div>\n"; + print git_navbar($project, $hash_base, "tree", ""); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" . "</div>\n"; @@ -1493,38 +1492,31 @@ $page = 0; } git_header_html(); - print "<div class=\"page_nav\">\n"; - print $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") . - " | log" . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; + my $navExtra = ""; my $limit = sprintf("--max-count=%i", (100 * ($page+1))); open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed."); my (@revlist) = map { chomp; $_ } <$fd>; close $fd; if ($hash ne $head || $page) { - print $cgi->a({-href => "$my_uri?p=$project;a=log"}, "HEAD"); + $navExtra .= $cgi->a({-href => "$my_uri?p=$project;a=log"}, "HEAD"); } else { - print "HEAD"; + $navExtra .= "HEAD"; } if ($page > 0) { - print " ⋅ " . + $navExtra .= " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash;pg=" . ($page-1), -accesskey => "p", -title => "Alt-p"}, "prev"); } else { - print " ⋅ prev"; + $navExtra .= " ⋅ prev"; } if ($#revlist >= (100 * ($page+1)-1)) { - print " ⋅ " . + $navExtra .= " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash;pg=" . ($page+1), -accesskey => "n", -title => "Alt-n"}, "next"); } else { - print " ⋅ next"; + $navExtra .= " ⋅ next"; } - print "<br/>\n" . - "</div>\n"; + print git_navbar($project, $hash, "log", $navExtra); if ([EMAIL PROTECTED]) { print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . @@ -1593,6 +1585,7 @@ @difftree = map { chomp; $_ } <$fd>; close $fd or die_error(undef, "Reading diff-tree failed."); git_header_html(); + # git_navbar omitted here - commitdiff link a bit weird o_O print "<div class=\"page_nav\">\n" . $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") . @@ -1773,16 +1766,7 @@ mkdir($git_temp, 0700); git_header_html(); if (defined $hash_base && (my %co = git_read_commit($hash_base))) { - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash_base"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash_base"}, "tree") . - "<br/>\n"; - print $cgi->a({-href => "$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent"}, "plain") . - "</div>\n"; + print git_navbar($project, $hash_base, "blobdiff", $cgi->a({-href => "$my_uri?p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent"}, "plain")); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash_base", -class => "title"}, escapeHTML($co{'title'})) . "\n" . "</div>\n"; @@ -1825,15 +1809,7 @@ close $fd or die_error(undef, "Reading diff-tree failed."); git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . - " | commitdiff" . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . "<br/>\n"; - print $cgi->a({-href => "$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent"}, "plain") . "\n" . - "</div>\n"; + print git_navbar($project, $hash, "commitdiff", $cgi->a({-href => "$my_uri?p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent"}, "plain")); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . "</div>\n"; @@ -1967,15 +1943,7 @@ die_error(undef, "Unknown commit object."); } git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . - "<br/><br/>\n" . - "</div>\n"; + print git_navbar($project, $hash, "history", ""); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . "</div>\n"; @@ -2051,15 +2019,7 @@ $pickaxe_search = 1; } git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary;h=$hash"}, "summary") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$co{'tree'};hb=$hash"}, "tree") . - "<br/><br/>\n" . - "</div>\n"; + print git_navbar($project, $hash, "search", ""); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash", -class => "title"}, escapeHTML($co{'title'})) . "\n" . @@ -2180,38 +2140,31 @@ $page = 0; } git_header_html(); - print "<div class=\"page_nav\">\n" . - $cgi->a({-href => "$my_uri?p=$project;a=summary"}, "summary") . - " | shortlog" . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$hash"}, "log") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$hash"}, "commit") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$hash"}, "commitdiff") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=tree;h=$hash;hb=$hash"}, "tree") . "<br/>\n"; my $limit = sprintf("--max-count=%i", (100 * ($page+1))); open my $fd, "-|", "$gitbin/git-rev-list $limit $hash" or die_error(undef, "Open failed."); my (@revlist) = map { chomp; $_ } <$fd>; close $fd; + my $navExtra = ""; if ($hash ne $head || $page) { - print $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD"); + $navExtra .= $cgi->a({-href => "$my_uri?p=$project;a=shortlog"}, "HEAD"); } else { - print "HEAD"; + $navExtra .= "HEAD"; } if ($page > 0) { - print " ⋅ " . + $navExtra .= " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page-1), -accesskey => "p", -title => "Alt-p"}, "prev"); } else { - print " ⋅ prev"; + $navExtra .= " ⋅ prev"; } if ($#revlist >= (100 * ($page+1)-1)) { - print " ⋅ " . + $navExtra .= " ⋅ " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$hash;pg=" . ($page+1), -accesskey => "n", -title => "Alt-n"}, "next"); } else { - print " ⋅ next"; + $navExtra .= " ⋅ next"; } - print "<br/>\n" . - "</div>\n"; + print git_navbar($project, $hash, "shortlog", $navExtra); print "<div>\n" . $cgi->a({-href => "$my_uri?p=$project;a=summary", -class => "title"}, " ") . "</div>\n";
--- ../gitweb/gitweb.cgi 2005-08-25 19:25:11.000000000 +0800 +++ gitweb.cgi 2005-08-26 17:50:57.000000000 +0800 @@ -40,6 +40,8 @@ #my $projects_list = $projectroot; my $projects_list = "index/index.aux"; +my $snapshots_url = "http://git.xmms.se/snapshot.cgi"; + # input validation and dispatch my $action = $cgi->param('a'); if (defined $action) { @@ -845,6 +847,7 @@ $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=summary"}, "summary") . " | " . $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=shortlog"}, "shortlog") . " | " . $cgi->a({-href => "$my_uri?p=$pr->{'path'};a=log"}, "log") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$pr->{'path'}&commit=HEAD"}, "latest snapshot") . "</td>\n" . "</tr>\n"; } @@ -984,6 +987,7 @@ "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$project&commit=$commit"}, "snapshot") . "</td>\n" . "</tr>"; } else { @@ -1033,7 +1037,8 @@ print $cgi->a({-href => "$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'refid'}"}, "log"); + " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'refid'}"}, "log") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$project&commit=$tag{'refid'}"}, "snapshot"); } print "</td>\n" . "</tr>"; @@ -1172,7 +1177,8 @@ print $cgi->a({-href => "$my_uri?p=$project;a=$tag{'reftype'};h=$tag{'refid'}"}, $tag{'reftype'}); if ($tag{'reftype'} eq "commit") { print " | " . $cgi->a({-href => "$my_uri?p=$project;a=shortlog;h=$tag{'name'}"}, "shortlog") . - " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'refid'}"}, "log"); + " | " . $cgi->a({-href => "$my_uri?p=$project;a=log;h=$tag{'refid'}"}, "log") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$project&commit=$tag{'refid'}"}, "snapshot"); } print "</td>\n" . "</tr>"; @@ -1545,6 +1551,7 @@ "<div class=\"log_link\">\n" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$project&commit=$commit"}, "snapshot") . "<br/>\n" . "</div>\n" . "<i>" . escapeHTML($co{'author_name'}) . " [$ad{'rfc2822'}]</i><br/>\n" . @@ -1646,6 +1653,8 @@ "</td>" . "</tr>\n"; } + print "<tr><td>snapshot</td>". + "<td><a href=\"$snapshots_url?tree=$project&commit=$hash\">$hash</a></td></tr>"; print "</table>". "</div>\n"; print "<div class=\"page_body\">\n"; @@ -2234,6 +2243,7 @@ "<td class=\"link\">" . $cgi->a({-href => "$my_uri?p=$project;a=commit;h=$commit"}, "commit") . " | " . $cgi->a({-href => "$my_uri?p=$project;a=commitdiff;h=$commit"}, "commitdiff") . + " | " . $cgi->a({-href => "$snapshots_url?tree=$project&commit=$commit"}, "snapshot") . "</td>\n" . "</tr>"; }
snapshot.cgi
Description: application/cgi