git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] gitweb: Improve "next" link in commitdiff view

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 8, 2007, 11:26 UTC
Message-ID
<20070608112502.3594.68102.stgit@roke.D-201>
In-Reply-To
<20070608112337.3594.93976.stgit@roke.D-201>

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 <jnareb@gmail.com>
---
This is sort of companion to previous commit, meaning thatI'd like to
see if I came from link to diff to one of parents in a merge commit.
Purely decoration, but I think it is nice.
 gitweb/gitweb.perl |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e2d5222..4561d4e 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -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)) .
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 8 in “gitweb: 'commitdiff' view improvements”
  1. 0/6 gitweb: 'commitdiff' view improvementsJakub Narebski, Jun 8, 2007
  2. 1/6 gitweb: Provide links to commitdiff to each parent in 'commitdiff' viewJakub Narebski, Jun 8, 2007
  3. 2/6 gitweb: Improve "next" link in commitdiff viewJakub Narebski, Jun 8, 2007
  4. 3/6 gitweb: Split git_patchset_body into separate subroutinesJakub Narebski, Jun 8, 2007
  5. 4/6 gitweb: Create special from-file/to-file header for combined diffJakub Narebski, Jun 8, 2007
  6. 5/6 gitweb: Add links to blobdiffs in from-file/to-file header for mergesJakub Narebski, Jun 8, 2007
  7. 6/6 gitweb: '--cc' for merges in 'commitdiff' viewJakub Narebski, Jun 8, 2007
  8. Junio C HamanoJun 11, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.