Skip to content

Commit 13e86ef

Browse files
jnarebJunio C Hamano
authored andcommitted
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>
1 parent ac8b0cd commit 13e86ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,7 +2525,7 @@ sub git_patchset_body {
25252525
last PATCH unless $patch_line;
25262526
next PATCH if ($patch_line =~ m/^diff /);
25272527
#assert($patch_line =~ m/^---/) if DEBUG;
2528-
if ($from{'href'}) {
2528+
if ($from{'href'} && $patch_line =~ m!^--- "?a/!) {
25292529
$patch_line = '--- a/' .
25302530
$cgi->a({-href=>$from{'href'}, -class=>"path"},
25312531
esc_path($from{'file'}));
@@ -2537,7 +2537,7 @@ sub git_patchset_body {
25372537
chomp $patch_line;
25382538

25392539
#assert($patch_line =~ m/^+++/) if DEBUG;
2540-
if ($to{'href'}) {
2540+
if ($to{'href'} && $patch_line =~ m!^\+\+\+ "?b/!) {
25412541
$patch_line = '+++ b/' .
25422542
$cgi->a({-href=>$to{'href'}, -class=>"path"},
25432543
esc_path($to{'file'}));

0 commit comments

Comments
 (0)