Browse Source

gitweb: Improve "next" link in commitdiff view

Check if 'hp' (hash_parent) parameter to 'commitdiff' view is one of
'h' (hash) commit parents, i.e. if commitdiff is of the form
"<commit>^<n> <commit>", and mark it as such in the bottom part of
navigation bar. The "next" link in commitdiff view was introduced
in commit 151602df00

If 'hb' is n-th parent of 'h', show the following at the bottom
of navigation bar:
  (from parent n: _commit_)

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Jakub Narebski 18 years ago committed by Junio C Hamano
parent
commit
ada3e1f733
  1. 9
      gitweb/gitweb.perl

9
gitweb/gitweb.perl

@ -4479,7 +4479,14 @@ sub git_commitdiff { @@ -4479,7 +4479,14 @@ sub git_commitdiff {
$hash_parent_short = substr($hash_parent, 0, 7);
}
$formats_nav .=
' (from: ' .
' (from';
for (my $i = 0; $i < @{$co{'parents'}}; $i++) {
if ($co{'parents'}[$i] eq $hash_parent) {
$formats_nav .= ' parent ' . ($i+1);
last;
}
}
$formats_nav .= ': ' .
$cgi->a({-href => href(action=>"commitdiff",
hash=>$hash_parent)},
esc_html($hash_parent_short)) .

Loading…
Cancel
Save