]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Improve "next" link in commitdiff view
authorJakub Narebski <redacted>
Fri, 8 Jun 2007 11:26:31 +0000 (13:26 +0200)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 151602df00b8e5c5b4a8193f59a94b85f9b5aebc

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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 22929671b8bc41e3cefd5b8acfa31c4cf34a8bb677738aafc44c66a2f03c5e2f..ff46f36441be9164d1cbfff76ae8c49ed8d2dd82fc946429f4484c8d6a4aa3d7 100755 (executable)
@@ -4480,7 +4480,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)) .
This page took 0.264011 seconds and 4 git commands to generate.