From: Martin Koegler Date: Sun, 25 Mar 2007 20:34:20 GMT Subject: [PATCH] gitweb: support filename prefix in git_patchset_body Message-ID: <11748548622060-git-send-email-mkoegler@auto.tuwien.ac.at> In-Reply-To: <11748548623841-git-send-email-mkoegler@auto.tuwien.ac.at> git_treediff supports comparing subdirectories. As the output of git-difftree is missing the path to the compared directories, the links in the output would be wrong. The patch adds two new parameters to add the missing path prefix. Signed-off-by: Martin Koegler --- gitweb/gitweb.perl | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 4c371b2..4195b1a 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -2372,7 +2372,7 @@ sub git_difftree_body { } sub git_patchset_body { - my ($fd, $difftree, $hash, $hash_parent) = @_; + my ($fd, $difftree, $hash, $hash_parent, $file_name, $file_parent) = @_; my $patch_idx = 0; my $patch_line; @@ -2380,6 +2380,9 @@ sub git_patchset_body { my $diffinfo; my (%from, %to); + $file_name = (!defined $file_name)?"":($file_name."/"); + $file_parent = (!defined $file_parent)?"":($file_parent."/"); + print "
\n"; # skip to first patch @@ -2439,14 +2442,14 @@ sub git_patchset_body { if ($diffinfo->{'status'} ne "A") { # not new (added) file $from{'href'} = href(action=>"blob", hash_base=>$hash_parent, hash=>$diffinfo->{'from_id'}, - file_name=>$from{'file'}); + file_name=>$file_parent.$from{'file'}); } else { delete $from{'href'}; } if ($diffinfo->{'status'} ne "D") { # not deleted file $to{'href'} = href(action=>"blob", hash_base=>$hash, hash=>$diffinfo->{'to_id'}, - file_name=>$to{'file'}); + file_name=>$file_name.$to{'file'}); } else { delete $to{'href'}; } -- 1.5.1.rc1.51.gb08b-dirty