Code

gitweb: Fix blob linenr links in pathinfo mode
authorPetr Baudis <pasky@suse.cz>
Fri, 6 Nov 2009 15:08:41 +0000 (16:08 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Nov 2009 17:56:34 +0000 (09:56 -0800)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl

index 24b219310a73f6ff8412b9236e7e5a95a7860e2f..184b683aa5a1fdf500ea9cb01ab949bad9e95020 100755 (executable)
@@ -5065,7 +5065,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);
                }
        }