Currently, blobdiff can only compare blobs with diffenrent file names, if no hb/hpb parameters are present. This patch adds support for comparing two blobs specified by hb/f and hpb/fp. Signed-off-by: Martin Koegler <mkoegler@xxxxxxxxxxxxxxxxx> --- gitweb/gitweb.perl | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index fbadab4..e3c2918 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3882,9 +3882,34 @@ sub git_blobdiff { my %diffinfo; my $expires; + if (defined $hash_base && defined $hash_parent_base && + defined $file_name && defined $file_parent) { + + $diffinfo{'from_mode'} = $diffinfo{'to_mode'} = "blob"; + $diffinfo{'from_file'} = $file_parent; + $diffinfo{'to_file'} = $file_name; + $diffinfo{'status'} = '2'; + + if (defined $hash) { + $diffinfo{'to_id'} = $hash; + } else { + $diffinfo{'to_id'} = git_get_hash_by_path($hash_base, $file_name); + } + if (defined $hash_parent) { + $diffinfo{'from_id'} = $hash_parent; + } else { + $diffinfo{'from_id'} = git_get_hash_by_path($hash_parent_base, $file_parent); + } + + # open patch output + open $fd, "-|", git_cmd(), "diff", '-p', @diff_opts, + $hash_parent_base.":".$file_parent, $hash_base.":".$file_name, "--" + or die_error(undef, "Open git-diff failed"); + } + # preparing $fd and %diffinfo for git_patchset_body # new style URI - if (defined $hash_base && defined $hash_parent_base) { + if (defined $hash_base && defined $hash_parent_base && !%diffinfo) { if (defined $file_name) { # read raw output open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts, -- 1.5.1.rc1.51.gb08b-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html