gitweb: link to patch(es) view in commit(diff) and (short)log view
We link to patch view in commit and commitdiff view, and to patches view in log and shortlog view. In (short)log view, the link is only offered when the number of commits shown is no more than the allowed maximum number of patches. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Giuseppe Bilotta committed
Dec 18, 2008 at 08:13 UTC
75bf2cb2983865760464ecec3fa1cd6f9d3719d5
1 file changed
+28
-2
gitweb/gitweb.perl
+28
-2
@@ -5023,6 +5023,15 @@ sub git_log {
5023
5024
my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);
5025
5026
+ my ($patch_max) = gitweb_get_feature('patches');
5027
+ if ($patch_max) {
5028
+ if ($patch_max < 0 || @commitlist <= $patch_max) {
5029
+ $paging_nav .= " ⋅ " .
5030
+ $cgi->a({-href => href(action=>"patches", -replay=>1)},
5031
+ "patches");
5032
+ }
5033
+ }
5034
+
5035
git_header_html();
5036
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
5037
@@ -5102,6 +5111,11 @@ sub git_commit {
5111
} @$parents ) .
5112
')';
5113
}
5114
+ if (gitweb_check_feature('patches')) {
5115
+ $formats_nav .= " | " .
5116
+ $cgi->a({-href => href(action=>"patch", -replay=>1)},
5117
+ "patch");
5118
+ }
5119
5120
if (!defined $parent) {
5121
$parent = "--root";
@@ -5415,9 +5429,8 @@ sub git_commitdiff {
5429
my %params = @_;
5430
my $format = $params{-format} || 'html';
5431
5418
- my $patch_max;
5432
+ my ($patch_max) = gitweb_get_feature('patches');
5433
if ($format eq 'patch') {
5420
- ($patch_max) = gitweb_get_feature('patches');
5434
die_error(403, "Patch view not allowed") unless $patch_max;
5435
}
5436
@@ -5435,6 +5448,11 @@ sub git_commitdiff {
5448
$formats_nav =
5449
$cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
5450
"raw");
5451
+ if ($patch_max) {
5452
+ $formats_nav .= " | " .
5453
+ $cgi->a({-href => href(action=>"patch", -replay=>1)},
5454
+ "patch");
5455
+ }
5456
5457
if (defined $hash_parent &&
5458
$hash_parent ne '-c' && $hash_parent ne '--cc') {
@@ -5991,6 +6009,14 @@ sub git_shortlog {
6009
$cgi->a({-href => href(-replay=>1, page=>$page+1),
6010
-accesskey => "n", -title => "Alt-n"}, "next");
6011
}
6012
+ my $patch_max = gitweb_check_feature('patches');
6013
+ if ($patch_max) {
6014
+ if ($patch_max < 0 || @commitlist <= $patch_max) {
6015
+ $paging_nav .= " ⋅ " .
6016
+ $cgi->a({-href => href(action=>"patches", -replay=>1)},
6017
+ "patches");
6018
+ }
6019
+ }
6020
6021
git_header_html();
6022
git_print_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);