Skip to content

Commit 75bf2cb

Browse files
Oblomovgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a3411f8 commit 75bf2cb

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

gitweb/gitweb.perl

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5023,6 +5023,15 @@ sub git_log {
50235023

50245024
my $paging_nav = format_paging_nav('log', $hash, $head, $page, $#commitlist >= 100);
50255025

5026+
my ($patch_max) = gitweb_get_feature('patches');
5027+
if ($patch_max) {
5028+
if ($patch_max < 0 || @commitlist <= $patch_max) {
5029+
$paging_nav .= " &sdot; " .
5030+
$cgi->a({-href => href(action=>"patches", -replay=>1)},
5031+
"patches");
5032+
}
5033+
}
5034+
50265035
git_header_html();
50275036
git_print_page_nav('log','', $hash,undef,undef, $paging_nav);
50285037

@@ -5102,6 +5111,11 @@ sub git_commit {
51025111
} @$parents ) .
51035112
')';
51045113
}
5114+
if (gitweb_check_feature('patches')) {
5115+
$formats_nav .= " | " .
5116+
$cgi->a({-href => href(action=>"patch", -replay=>1)},
5117+
"patch");
5118+
}
51055119

51065120
if (!defined $parent) {
51075121
$parent = "--root";
@@ -5415,9 +5429,8 @@ sub git_commitdiff {
54155429
my %params = @_;
54165430
my $format = $params{-format} || 'html';
54175431

5418-
my $patch_max;
5432+
my ($patch_max) = gitweb_get_feature('patches');
54195433
if ($format eq 'patch') {
5420-
($patch_max) = gitweb_get_feature('patches');
54215434
die_error(403, "Patch view not allowed") unless $patch_max;
54225435
}
54235436

@@ -5435,6 +5448,11 @@ sub git_commitdiff {
54355448
$formats_nav =
54365449
$cgi->a({-href => href(action=>"commitdiff_plain", -replay=>1)},
54375450
"raw");
5451+
if ($patch_max) {
5452+
$formats_nav .= " | " .
5453+
$cgi->a({-href => href(action=>"patch", -replay=>1)},
5454+
"patch");
5455+
}
54385456

54395457
if (defined $hash_parent &&
54405458
$hash_parent ne '-c' && $hash_parent ne '--cc') {
@@ -5991,6 +6009,14 @@ sub git_shortlog {
59916009
$cgi->a({-href => href(-replay=>1, page=>$page+1),
59926010
-accesskey => "n", -title => "Alt-n"}, "next");
59936011
}
6012+
my $patch_max = gitweb_check_feature('patches');
6013+
if ($patch_max) {
6014+
if ($patch_max < 0 || @commitlist <= $patch_max) {
6015+
$paging_nav .= " &sdot; " .
6016+
$cgi->a({-href => href(action=>"patches", -replay=>1)},
6017+
"patches");
6018+
}
6019+
}
59946020

59956021
git_header_html();
59966022
git_print_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);

0 commit comments

Comments
 (0)