summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jakub Narebski <jnareb@gmail.com>2007-03-30 23:41:26 +0200
committerLibravatar Junio C Hamano <junkio@cox.net>2007-03-31 00:47:48 -0700
commit5ae917acdf40444945271e5e014cda37e202504e (patch)
treea31518db1b3f744f853687c4ee9c77666f304120
parentDo not bother documenting fetch--tool (diff)
downloadtgif-5ae917acdf40444945271e5e014cda37e202504e.tar.xz
gitweb: Support comparing blobs (files) with different names
Fix the bug that caused "blobdiff" view called with new style URI for a rename with change diff to be show as new (added) file diff. New style URI for "blobdiff" for rename means with $hash_base ('hb') and $hash_parent_base ('hpb') paramaters denoting tree-ish (usually commit) of a blobs being compared, together with both $file_name ('f') and $file_parent ('fp') parameters. It is done by adding $file_parent ('fp') to the path limiter, meaning that diff command becomes: git diff-tree [options] hpb hb -- fp f Other option would be finding hash of a blob using git_get_hash_by_path subroutine and comparing blobs using git-diff, or using extended SHA-1 syntax and compare blobs using git-diff: git diff [options] hpb:fp hp:f Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
-rwxr-xr-xgitweb/gitweb.perl4
1 files changed, 2 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3348583227..3786955fca 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3885,7 +3885,7 @@ sub git_blobdiff {
# read raw output
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
$hash_parent_base, $hash_base,
- "--", $file_name
+ "--", (defined $file_parent ? $file_parent : ()), $file_name
or die_error(undef, "Open git-diff-tree failed");
@difftree = map { chomp; $_ } <$fd>;
close $fd
@@ -3935,7 +3935,7 @@ sub git_blobdiff {
# open patch output
open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
'-p', $hash_parent_base, $hash_base,
- "--", $file_name
+ "--", (defined $file_parent ? $file_parent : ()), $file_name
or die_error(undef, "Open git-diff-tree failed");
}