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

[PATCH] gitweb: Restore object-named links in item lists

From
Petr Baudis <pasky@suse.cz>
Date
Oct 11, 2006, 20:18 UTC
Message-ID
<20061011201812.26857.58295.stgit@rover>

This restores the redundant links removed earlier. It supersedes my patch to stick slashes to tree entries.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 gitweb/gitweb.perl |   42 ++++++++++++++++++++++++++++--------------
 1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index a11fa38..d8298b9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1785,18 +1785,20 @@ sub git_print_tree_entry {
 					       file_name=>"$basedir$t->{'name'}", %base_key),
 				 -class => "list"}, esc_html($t->{'name'})) . "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "blob");
 		if ($have_blame) {
-			print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
+			print " | " .
+				$cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
 						     file_name=>"$basedir$t->{'name'}", %base_key)},
-				      "blame");
+					"blame");
 		}
 		if (defined $hash_base) {
-			if ($have_blame) {
-				print " | ";
-			}
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+				$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             hash=>$t->{'hash'}, file_name=>"$basedir$t->{'name'}")},
-			              "history");
+					"history");
 		}
 		print " | " .
 			$cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
@@ -1811,17 +1813,19 @@ sub git_print_tree_entry {
 		              esc_html($t->{'name'}));
 		print "</td>\n";
 		print "<td class=\"link\">";
+		print $cgi->a({-href => href(action=>"tree", hash=>$t->{'hash'},
+					     file_name=>"$basedir$t->{'name'}", %base_key)},
+			      "tree");
 		if (defined $hash_base) {
-			print $cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
+			print " | " .
+				$cgi->a({-href => href(action=>"history", hash_base=>$hash_base,
 			                             file_name=>"$basedir$t->{'name'}")},
-			              "history");
-			if ($have_snapshot) {
-				print " | ";
-			}
+					"history");
 		}
 		if ($have_snapshot) {
-			print $cgi->a({-href => href(action=>"snapshot", hash=>$t->{'hash'})},
-				      "snapshot");
+			print " | " .
+				$cgi->a({-href => href(action=>"snapshot", hash=>$t->{'hash'})},
+					"snapshot");
 		}
 		print "</td>\n";
 	}
@@ -1902,6 +1906,9 @@ sub git_difftree_body {
 				print $cgi->a({-href => "#patch$patchno"}, "patch");
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+			                             hash_base=>$parent, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 						     file_name=>$diff{'file'})},
 				      "blame") . " | ";
@@ -1947,6 +1954,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
+						     hash_base=>$hash, file_name=>$diff{'file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
 						     file_name=>$diff{'file'})},
 				      "blame") . " | ";
@@ -1987,6 +1997,9 @@ sub git_difftree_body {
 				}
 				print " | ";
 			}
+			print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
+						     hash_base=>$parent, file_name=>$diff{'from_file'})},
+				      "blob") . " | ";
 			print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
 						     file_name=>$diff{'from_file'})},
 				      "blame") . " | ";
@@ -2154,6 +2167,7 @@ sub git_shortlog_body {
 		                          href(action=>"commit", hash=>$commit), $ref);
 		print "</td>\n" .
 		      "<td class=\"link\">" .
+		      $cgi->a({-href => href(action=>"commit", hash=>$commit)}, "commit") . " | " .
 		      $cgi->a({-href => href(action=>"commitdiff", hash=>$commit)}, "commitdiff") . " | " .
 		      $cgi->a({-href => href(action=>"tree", hash=>$commit, hash_base=>$commit)}, "tree");
 		if (gitweb_have_snapshot()) {
Next: Junio C Hamano
Message 1 of 4 in “gitweb: Restore object-named links in item lists”
  1. gitweb: Restore object-named links in item listsPetr Baudis, Oct 11, 2006
  2. Junio C HamanoOct 11, 2006
  3. Luben TuikovOct 11, 2006
  4. Jakub NarebskiOct 11, 2006

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.