gitweb: fix #patchNN anchors when path_info is enabled
authorKevin Cernekee <cernekee@gmail.com>
Fri, 18 Mar 2011 16:00:16 +0000 (17:00 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 18 Mar 2011 19:29:31 +0000 (12:29 -0700)
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 <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found