@matheusbsbs / matheus-bagliano / commits / 957d6ea78f
Fork 0

gitweb: Fix bug in "blobdiff" view for split (e.g. file to symlink) patches

git_patchset_body needs patch generated with --full-index option to detect split patches, meaning two patches which corresponds to single difftree (raw diff) entry. An example of such situation is changing type (mode) of a file, e.g. from plain file to symbolic link. Add, in git_blobdiff, --full-index option to patch generating git diff invocation, for the 'html' format output ("blobdiff" view). "blobdiff_plain" still uses shortened sha1 in the extended git diff header "index <hash>..<hash>[ <mode>]" line. Noticed-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Apr 5, 2007 at 13:45 UTC 957d6ea78fcbe71481a6f46a58768e100f7908e0
1 file changed +4 -2
gitweb/gitweb.perl
+4 -2
@@ -3934,7 +3934,8 @@ sub git_blobdiff {
3934
3935 # open patch output
3936 open $fd, "-|", git_cmd(), "diff-tree", '-r', @diff_opts,
3937 - '-p', $hash_parent_base, $hash_base,
3937 + '-p', ($format eq 'html' ? "--full-index" : ()),
3938 + $hash_parent_base, $hash_base,
3939 "--", (defined $file_parent ? $file_parent : ()), $file_name
3940 or die_error(undef, "Open git-diff-tree failed");
3941 }
@@ -3969,7 +3970,8 @@ sub git_blobdiff {
3970 }
3971
3972 # open patch output
3972 - open $fd, "-|", git_cmd(), "diff", '-p', @diff_opts,
3973 + open $fd, "-|", git_cmd(), "diff", @diff_opts,
3974 + '-p', ($format eq 'html' ? "--full-index" : ()),
3975 $hash_parent, $hash, "--"
3976 or die_error(undef, "Open git-diff failed");
3977 } else {