gitweb: Fix file links in "grep" search
authorJakub Narebski <jnareb@gmail.com>
Thu, 5 Jan 2012 20:26:48 +0000 (21:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Thu, 5 Jan 2012 21:29:50 +0000 (13:29 -0800)
There were two bugs in generating file links (links to "blob" view),
one hidden by the other. The correct way of generating file link is

href(action=>"blob", hash_base=>$co{'id'},
file_name=>$file);

It was $co{'hash'} (this key does not exist, and therefore this is
undef), and 'hash' instead of 'hash_base'.

To have this fix applied in single place, this commit also reduces
code duplication by saving file link (which is used for line links) in
$file_href.

Reported-by: Thomas Perl <th.perl@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
No differences found