]> Lady’s Gitweb - Gitweb/commitdiff
gitweb: Fix split patches output (e.g. file to symlink)
authorJakub Narebski <redacted>
Sun, 7 Jan 2007 01:52:27 +0000 (02:52 +0100)
committerLady <redacted>
Mon, 6 Apr 2026 04:07:11 +0000 (00:07 -0400)
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 <redacted>
Signed-off-by: Junio C Hamano <redacted>
gitweb.perl

index 191be31419dbf0b8a3bf4ae6edaea6a72047932911e2fadc4df1896911cb9b0e..d03b97b1221ac25f1e52a4e5e1ce4451d4a8a5fd479b68bdfc95845876fdc250 100755 (executable)
@@ -2526,7 +2526,7 @@ sub git_patchset_body {
                last PATCH unless $patch_line;
                next PATCH if ($patch_line =~ m/^diff /);
                #assert($patch_line =~ m/^---/) if DEBUG;
                last PATCH unless $patch_line;
                next PATCH if ($patch_line =~ m/^diff /);
                #assert($patch_line =~ m/^---/) if DEBUG;
-               if ($from{'href'}) {
+               if ($from{'href'} && $patch_line =~ m!^--- "?a/!) {
                        $patch_line = '--- a/' .
                                      $cgi->a({-href=>$from{'href'}, -class=>"path"},
                                              esc_path($from{'file'}));
                        $patch_line = '--- a/' .
                                      $cgi->a({-href=>$from{'href'}, -class=>"path"},
                                              esc_path($from{'file'}));
@@ -2538,7 +2538,7 @@ sub git_patchset_body {
                chomp $patch_line;
 
                #assert($patch_line =~ m/^+++/) if DEBUG;
                chomp $patch_line;
 
                #assert($patch_line =~ m/^+++/) if DEBUG;
-               if ($to{'href'}) {
+               if ($to{'href'} && $patch_line =~ m!^\+\+\+ "?b/!) {
                        $patch_line = '+++ b/' .
                                      $cgi->a({-href=>$to{'href'}, -class=>"path"},
                                              esc_path($to{'file'}));
                        $patch_line = '+++ b/' .
                                      $cgi->a({-href=>$to{'href'}, -class=>"path"},
                                              esc_path($to{'file'}));
This page took 0.232917 seconds and 4 git commands to generate.