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

[PATCH] gitweb: Fix blob linenr links in pathinfo mode

From
Petr Baudis <pasky@suse.cz>
Date
Nov 6, 2009, 15:08 UTC
Message-ID
<1257520121-17282-1-git-send-email-pasky@suse.cz>

In pathinfo mode, we use <base href> that refers to the base location of gitweb in order for various external media links to work well. However, this means that for the page to refer to itself, it must regenerate full link, and this is exactly what the blob view page did not do for line numbers.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---
 gitweb/gitweb.perl |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e4cbfc3..62325ea 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -5127,7 +5127,8 @@ sub git_blob {
 			chomp $line;
 			$nr++;
 			$line = untabify($line);
-			printf "<div class=\"pre\"><a id=\"l%i\" href=\"#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
+			printf "<div class=\"pre\"><a id=\"l%i\" href=\"" . href(-replay => 1)
+				. "#l%i\" class=\"linenr\">%4i</a> %s</div>\n",
 			       $nr, $nr, $nr, esc_html($line, -nbsp=>1);
 		}
 	}
-- 
tg: (8cc62c1..) t/blob/pathinfo (depends on: vanilla/master)
Message 1 of 1 in “gitweb: Fix blob linenr links in pathinfo mode”
  1. gitweb: Fix blob linenr links in pathinfo modePetr Baudis, Nov 6, 2009

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.