@matheusbsbs / matheus-bagliano / commits / 13e86efbea
Fork 0

gitweb: Fix split patches output (e.g. file to symlink)

Do not replace /dev/null in two-line from-file/to-file diff header for split patches ("split" patch mean more than one patch per one diff-tree raw line) by a/file or b/file link. Split patches differ from pair of deletion/creation patch in git diff header: both a/file and b/file are hyperlinks, in all patches in a split. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Jan 7, 2007 at 02:52 UTC 13e86efbeae5994a85cc482b3964db7298c5c6ea
1 file changed +2 -2
gitweb/gitweb.perl
+2 -2
@@ -2525,7 +2525,7 @@ sub git_patchset_body {
2525 last PATCH unless $patch_line;
2526 next PATCH if ($patch_line =~ m/^diff /);
2527 #assert($patch_line =~ m/^---/) if DEBUG;
2528 - if ($from{'href'}) {
2528 + if ($from{'href'} && $patch_line =~ m!^--- "?a/!) {
2529 $patch_line = '--- a/' .
2530 $cgi->a({-href=>$from{'href'}, -class=>"path"},
2531 esc_path($from{'file'}));
@@ -2537,7 +2537,7 @@ sub git_patchset_body {
2537 chomp $patch_line;
2538
2539 #assert($patch_line =~ m/^+++/) if DEBUG;
2540 - if ($to{'href'}) {
2540 + if ($to{'href'} && $patch_line =~ m!^\+\+\+ "?b/!) {
2541 $patch_line = '+++ b/' .
2542 $cgi->a({-href=>$to{'href'}, -class=>"path"},
2543 esc_path($to{'file'}));