]> Lady’s Gitweb - Gitweb/commit
gitweb: fix #patchNN anchors when path_info is enabled
authorKevin Cernekee <redacted>
Fri, 18 Mar 2011 16:00:16 +0000 (17:00 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:51:30 +0000 (00:51 -0400)
commitd3623d982808a42f4195e8c30b093417535601de4d8d784ee589fad197021791
tree91cf1323860a8362278df1add8f2cfc68aca481c7c9f33ce94508c39054b290f
parent84c5dbe443953cefaf72c93941b32e279509791359f628f125eaad91d093371b
gitweb: fix #patchNN anchors when path_info is enabled

When $feature{'pathinfo'} is used, gitweb script sets the base URL to
itself, so that relative links to static files work correctly.  It
does it by adding something like below to HTML head:

  <base href="http://HOST/gitweb.cgi">

This breaks the "patch" anchor links seen on the commitdiff pages,
because these links, being relative (<a href="#patch1">), are resolved
(computed) relative to the base URL and not relative to current URL,
i.e. as:

  http://HOST/gitweb.cgi#patch1

Instead, they should look like this:

  http://HOST/gitweb.cgi/myproject.git/commitdiff/35a9811ef9d68eae9afd76bede121da4f89b448c#patch1

Add an "-anchor" parameter to href(), and use href(-anchor=>"patch1")
to generate "patch" anchor links, so that the full path is included in
the patch link.

While at it, convert

  print "foo";
  print "bar";

to

  print "foo" .
        "bar";

in the neighborhood of changes.

Signed-off-by: Kevin Cernekee <redacted>
Signed-off-by: Jakub Narebski <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl
This page took 0.224664 seconds and 4 git commands to generate.