From: Petr Baudis <pasky@suse.cz>
To: git@vger.kernel.org
To: git@vger.kernel.org
Cc: Petr Baudis <petr.baudis@novartis.com>
Subject: [PATCH] gitweb: Unify shortlog/log links
Date: Fri, 3 Oct 2008 15:45:02 +0200 [thread overview]
Message-ID: <1223041502-5204-1-git-send-email-pasky@suse.cz> (raw)
In-Reply-To: <1222958212-5896-1-git-send-email-pasky@suse.cz>
Instead of 'shortlog | log', we use only 'log' now, pointing to the shortlog
action, since that is what most people are usually interested in first. In the
action-specific navbar, you can then choose between short and full log view.
The aim of this patch is to reduce the overwhelming number of links by
including only orthogonal links to most popular views.
Signed-off-by: Petr Baudis <petr.baudis@novartis.com>
---
gitweb/gitweb.perl | 46 +++++++++++++++++++++++++++++++++-------------
1 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 9fbc9f8..58fc137 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2761,7 +2761,7 @@ sub git_print_page_nav {
my ($current, $suppress, $head, $treehead, $treebase, $extra) = @_;
$extra = '' if !defined $extra; # pager or formats
- my @navs = qw(summary shortlog log commit commitdiff tree);
+ my @navs = qw(summary log commit commitdiff tree);
if ($suppress) {
@navs = grep { $_ ne $suppress } @navs;
}
@@ -2772,12 +2772,11 @@ sub git_print_page_nav {
$arg{$_}{'hash'} = $head;
}
if ($current =~ m/^(tree | log | shortlog | commit | commitdiff | search)$/x) {
- for (qw(shortlog log)) {
- $arg{$_}{'hash'} = $head;
- }
+ $arg{'log'}{'hash'} = $head;
}
}
+ $arg{'log'}{'action'} = 'shortlog';
$arg{'tree'}{'hash'} = $treehead if defined $treehead;
$arg{'tree'}{'hash_base'} = $treebase if defined $treebase;
@@ -2832,6 +2831,26 @@ sub format_paging_nav {
return $paging_nav;
}
+sub format_log_nav {
+ my ($action, $hash, $head, $page, $has_next_link) = @_;
+ my $paging_nav;
+
+ if ($action eq 'shortlog') {
+ $paging_nav .= 'shortlog';
+ } else {
+ $paging_nav .= $cgi->a({-href => href(action=>'shortlog', -replay=>1)}, 'shortlog');
+ }
+ $paging_nav .= ' | ';
+ if ($action eq 'log') {
+ $paging_nav .= 'fulllog';
+ } else {
+ $paging_nav .= $cgi->a({-href => href(action=>'log', -replay=>1)}, 'fulllog');
+ }
+
+ $paging_nav .= " | " . format_paging_nav($action, $hash, $head, $page, $has_next_link);
+ return $paging_nav;
+}
+
## ......................................................................
## functions printing or outputting HTML: div
@@ -3722,8 +3741,7 @@ sub git_project_list_body {
(defined $pr->{'age_string'} ? $pr->{'age_string'} : "No commits") . "</td>\n" .
"<td class=\"link\">" .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"summary")}, "summary") . " | " .
- $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "shortlog") . " | " .
- $cgi->a({-href => href(project=>$pr->{'path'}, action=>"log")}, "log") . " | " .
+ $cgi->a({-href => href(project=>$pr->{'path'}, action=>"shortlog")}, "log") . " | " .
$cgi->a({-href => href(project=>$pr->{'path'}, action=>"tree")}, "tree") .
($pr->{'forks'} ? " | " . $cgi->a({-href => href(project=>$pr->{'path'}, action=>"forks")}, "forks") : '') .
"</td>\n" .
@@ -3894,8 +3912,7 @@ sub git_tags_body {
"<td class=\"link\">" . " | " .
$cgi->a({-href => href(action=>$tag{'reftype'}, hash=>$tag{'refid'})}, $tag{'reftype'});
if ($tag{'reftype'} eq "commit") {
- print " | " . $cgi->a({-href => href(action=>"shortlog", hash=>$tag{'fullname'})}, "shortlog") .
- " | " . $cgi->a({-href => href(action=>"log", hash=>$tag{'fullname'})}, "log");
+ print " | " . $cgi->a({-href => href(action=>"shortlog", hash=>$tag{'fullname'})}, "log");
} elsif ($tag{'reftype'} eq "blob") {
print " | " . $cgi->a({-href => href(action=>"blob_plain", hash=>$tag{'refid'})}, "raw");
}
@@ -3934,8 +3951,7 @@ sub git_heads_body {
-class => "list name"},esc_html($ref{'name'})) .
"</td>\n" .
"<td class=\"link\">" .
- $cgi->a({-href => href(action=>"shortlog", hash=>$ref{'fullname'})}, "shortlog") . " | " .
- $cgi->a({-href => href(action=>"log", hash=>$ref{'fullname'})}, "log") . " | " .
+ $cgi->a({-href => href(action=>"shortlog", hash=>$ref{'fullname'})}, "log") . " | " .
$cgi->a({-href => href(action=>"tree", hash=>$ref{'fullname'}, hash_base=>$ref{'name'})}, "tree") .
"</td>\n" .
"</tr>";
@@ -4628,9 +4644,12 @@ sub git_log {
my @commitlist = parse_commits($hash, 101, (100 * $page));
- my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);
+ my $paging_nav = format_log_nav('log', $hash, $head, $page, $#commitlist >= 100);
- git_header_html();
+ {
+ local $action = 'fulllog';
+ git_header_html();
+ }
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
if (!@commitlist) {
@@ -5533,7 +5552,8 @@ sub git_shortlog {
my @commitlist = parse_commits($hash, 101, (100 * $page));
- my $paging_nav = format_paging_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);
+ my $paging_nav = format_log_nav('shortlog', $hash, $head, $page, $#commitlist >= 100);
+
my $next_link = '';
if ($#commitlist >= 100) {
$next_link =
--
tg: (7fac06d..) t/extra-actions/log-consolidate (depends on: t/extra-actions/extra-actions)
prev parent reply other threads:[~2008-10-03 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-02 14:36 [PATCH] gitweb: Add support for extending the action bar with custom links Petr Baudis
2008-10-03 13:45 ` Petr Baudis [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1223041502-5204-1-git-send-email-pasky@suse.cz \
--to=pasky@suse.cz \
--cc=git@vger.kernel.org \
--cc=petr.baudis@novartis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).