]> Lady’s Gitweb - Gitweb/blobdiff - gitweb.perl
gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
[Gitweb] / gitweb.perl
index 70469f29bd192237bb77ad7811b94764435b6a42fde55e621e0ff5d1eff0f771..bcf8b84b22d9290904cea644e9c6eff5bc8259ca7b7f775c9f21ea64bad1431c 100755 (executable)
@@ -4891,7 +4891,7 @@ sub print_sidebyside_diff_chunk {
                # empty contents block on start rem/add block, or end of chunk
                if (@ctx && (!$class || $class eq 'rem' || $class eq 'add')) {
                        print join '',
                # empty contents block on start rem/add block, or end of chunk
                if (@ctx && (!$class || $class eq 'rem' || $class eq 'add')) {
                        print join '',
-                               '<div class="chunk_block">',
+                               '<div class="chunk_block ctx">',
                                        '<div class="old">',
                                        @ctx,
                                        '</div>',
                                        '<div class="old">',
                                        @ctx,
                                        '</div>',
@@ -4903,15 +4903,34 @@ sub print_sidebyside_diff_chunk {
                }
                # empty add/rem block on start context block, or end of chunk
                if ((@rem || @add) && (!$class || $class eq 'ctx')) {
                }
                # empty add/rem block on start context block, or end of chunk
                if ((@rem || @add) && (!$class || $class eq 'ctx')) {
-                       print join '',
-                               '<div class="chunk_block">',
-                                       '<div class="old">',
-                                       @rem,
-                                       '</div>',
-                                       '<div class="new">',
-                                       @add,
-                                       '</div>',
-                               '</div>';
+                       if (!@add) {
+                               # pure removal
+                               print join '',
+                                       '<div class="chunk_block rem">',
+                                               '<div class="old">',
+                                               @rem,
+                                               '</div>',
+                                       '</div>';
+                       } elsif (!@rem) {
+                               # pure addition
+                               print join '',
+                                       '<div class="chunk_block add">',
+                                               '<div class="new">',
+                                               @add,
+                                               '</div>',
+                                       '</div>';
+                       } else {
+                               # assume that it is change
+                               print join '',
+                                       '<div class="chunk_block chg">',
+                                               '<div class="old">',
+                                               @rem,
+                                               '</div>',
+                                               '<div class="new">',
+                                               @add,
+                                               '</div>',
+                                       '</div>';
+                       }
                        @rem = @add = ();
                }
 
                        @rem = @add = ();
                }
 
@@ -7249,8 +7268,8 @@ sub git_commitdiff {
                                }
                        }
                        $formats_nav .= ': ' .
                                }
                        }
                        $formats_nav .= ': ' .
-                               $cgi->a({-href => href(action=>"commitdiff",
-                                                      hash=>$hash_parent)},
+                               $cgi->a({-href => href(-replay=>1,
+                                                      hash=>$hash_parent, hash_base=>undef)},
                                        esc_html($hash_parent_short)) .
                                ')';
                } elsif (!$co{'parent'}) {
                                        esc_html($hash_parent_short)) .
                                ')';
                } elsif (!$co{'parent'}) {
@@ -7260,28 +7279,28 @@ sub git_commitdiff {
                        # single parent commit
                        $formats_nav .=
                                ' (parent: ' .
                        # single parent commit
                        $formats_nav .=
                                ' (parent: ' .
-                               $cgi->a({-href => href(action=>"commitdiff",
-                                                      hash=>$co{'parent'})},
+                               $cgi->a({-href => href(-replay=>1,
+                                                      hash=>$co{'parent'}, hash_base=>undef)},
                                        esc_html(substr($co{'parent'}, 0, 7))) .
                                ')';
                } else {
                        # merge commit
                        if ($hash_parent eq '--cc') {
                                $formats_nav .= ' | ' .
                                        esc_html(substr($co{'parent'}, 0, 7))) .
                                ')';
                } else {
                        # merge commit
                        if ($hash_parent eq '--cc') {
                                $formats_nav .= ' | ' .
-                                       $cgi->a({-href => href(action=>"commitdiff",
+                                       $cgi->a({-href => href(-replay=>1,
                                                               hash=>$hash, hash_parent=>'-c')},
                                                'combined');
                        } else { # $hash_parent eq '-c'
                                $formats_nav .= ' | ' .
                                                               hash=>$hash, hash_parent=>'-c')},
                                                'combined');
                        } else { # $hash_parent eq '-c'
                                $formats_nav .= ' | ' .
-                                       $cgi->a({-href => href(action=>"commitdiff",
+                                       $cgi->a({-href => href(-replay=>1,
                                                               hash=>$hash, hash_parent=>'--cc')},
                                                'compact');
                        }
                        $formats_nav .=
                                ' (merge: ' .
                                join(' ', map {
                                                               hash=>$hash, hash_parent=>'--cc')},
                                                'compact');
                        }
                        $formats_nav .=
                                ' (merge: ' .
                                join(' ', map {
-                                       $cgi->a({-href => href(action=>"commitdiff",
-                                                              hash=>$_)},
+                                       $cgi->a({-href => href(-replay=>1,
+                                                              hash=>$_, hash_base=>undef)},
                                                esc_html(substr($_, 0, 7)));
                                } @{$co{'parents'}} ) .
                                ')';
                                                esc_html(substr($_, 0, 7)));
                                } @{$co{'parents'}} ) .
                                ')';
This page took 0.403447 seconds and 4 git commands to generate.