From ef10ee877f6d4db4c9bc65d0e36b3670f0fe114e Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Fri, 25 Aug 2006 21:05:07 +0200 Subject: gitweb: Add invisible hyperlink to from-file/to-file diff header Change replacing hashes as from-file/to-file with filenames from difftree to adding invisible (except underlining on hover/mouseover) hyperlink to from-file/to-file blob. /dev/null as from-file or to-file is not changed (is not hyperlinked). This makes two-file from-file/to-file unified diff header parsing in git_patchset_body more generic, and not only for legacy blobdiffs. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gitweb/gitweb.perl') diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index b2159bb820..29953429ee 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -1711,8 +1711,11 @@ sub git_patchset_body { my $file = $diffinfo->{'from_file'}; $file ||= $diffinfo->{'file'}; - $patch_line =~ s|a/[0-9a-fA-F]{40}|a/$file|g; - print "
" . esc_html($patch_line) . "
\n"; + $file = $cgi->a({-href => href(action=>"blob", hash_base=>$hash_parent, + hash=>$diffinfo->{'from_id'}, file_name=>$file), + -class => "list"}, esc_html($file)); + $patch_line =~ s|a/.*$|a/$file|g; + print "
$patch_line
\n"; $patch_line = <$fd>; chomp $patch_line; @@ -1720,8 +1723,11 @@ sub git_patchset_body { #$patch_line =~ m/^+++/; $file = $diffinfo->{'to_file'}; $file ||= $diffinfo->{'file'}; - $patch_line =~ s|b/[0-9a-fA-F]{40}|b/$file|g; - print "
" . esc_html($patch_line) . "
\n"; + $file = $cgi->a({-href => href(action=>"blob", hash_base=>$hash, + hash=>$diffinfo->{'to_id'}, file_name=>$file), + -class => "list"}, esc_html($file)); + $patch_line =~ s|b/.*|b/$file|g; + print "
$patch_line
\n"; next LINE; } -- cgit v1.2.3