@matheusbsbs / matheus-bagliano / commits / 499faeda1b
Fork 0

gitweb: Remove excessively redundant entries from git_difftree_body

1) All entries on the left are blobs and clicking on them leads to blobs. No more diff or blob depending on what happened (modified or mode changed) to the file -- this goes to the right, in the "link" column. 2) Remove redundant "blob" from the link column on the right. This can now be had by clicking on the entry itself. This reduces and simplifies the code. Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luben Tuikov committed Sep 27, 2006 at 17:23 UTC 499faeda1bd131f7c3b216c16eebbe30049728d3
1 file changed +34 -58
gitweb/gitweb.perl
+34 -58
@@ -1732,47 +1732,39 @@ sub git_difftree_body {
1732 my $mode_chng = "<span class=\"file_status new\">[new $to_file_type";
1733 $mode_chng .= " with mode: $to_mode_str" if $to_mode_str;
1734 $mode_chng .= "]</span>";
1735 - print "<td>" .
1736 - $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1735 + print "<td>";
1736 + print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1737 hash_base=>$hash, file_name=>$diff{'file'}),
1738 - -class => "list"}, esc_html($diff{'file'})) .
1739 - "</td>\n" .
1740 - "<td>$mode_chng</td>\n" .
1741 - "<td class=\"link\">" .
1742 - $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1743 - hash_base=>$hash, file_name=>$diff{'file'})},
1744 - "blob");
1738 + -class => "list"}, esc_html($diff{'file'}));
1739 + print "</td>\n";
1740 + print "<td>$mode_chng</td>\n";
1741 + print "<td class=\"link\">";
1742 if ($action eq 'commitdiff') {
1743 # link to patch
1744 $patchno++;
1748 - print " | " .
1749 - $cgi->a({-href => "#patch$patchno"}, "patch");
1745 + print $cgi->a({-href => "#patch$patchno"}, "patch");
1746 }
1747 print "</td>\n";
1748
1749 } elsif ($diff{'status'} eq "D") { # deleted
1750 my $mode_chng = "<span class=\"file_status deleted\">[deleted $from_file_type]</span>";
1755 - print "<td>" .
1756 - $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
1751 + print "<td>";
1752 + print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
1753 hash_base=>$parent, file_name=>$diff{'file'}),
1758 - -class => "list"}, esc_html($diff{'file'})) .
1759 - "</td>\n" .
1760 - "<td>$mode_chng</td>\n" .
1761 - "<td class=\"link\">" .
1762 - $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
1763 - hash_base=>$parent, file_name=>$diff{'file'})},
1764 - "blob") .
1765 - " | ";
1754 + -class => "list"}, esc_html($diff{'file'}));
1755 + print "</td>\n";
1756 + print "<td>$mode_chng</td>\n";
1757 + print "<td class=\"link\">";
1758 if ($action eq 'commitdiff') {
1759 # link to patch
1760 $patchno++;
1769 - print " | " .
1770 - $cgi->a({-href => "#patch$patchno"}, "patch");
1761 + print $cgi->a({-href => "#patch$patchno"}, "patch");
1762 + print " | ";
1763 }
1764 print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
1765 file_name=>$diff{'file'})},
1774 - "history") .
1775 - "</td>\n";
1766 + "history");
1767 + print "</td>\n";
1768
1769 } elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
1770 my $mode_chnge = "";
@@ -1791,42 +1783,29 @@ sub git_difftree_body {
1783 $mode_chnge .= "]</span>\n";
1784 }
1785 print "<td>";
1794 - if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
1795 - print $cgi->a({-href => href(action=>"blobdiff",
1796 - hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1797 - hash_base=>$hash, hash_parent_base=>$parent,
1798 - file_name=>$diff{'file'}),
1799 - -class => "list"}, esc_html($diff{'file'}));
1800 - } else { # only mode changed
1801 - print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1802 - hash_base=>$hash, file_name=>$diff{'file'}),
1803 - -class => "list"}, esc_html($diff{'file'}));
1804 - }
1805 - print "</td>\n" .
1806 - "<td>$mode_chnge</td>\n" .
1807 - "<td class=\"link\">" .
1808 - $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1809 - hash_base=>$hash, file_name=>$diff{'file'})},
1810 - "blob");
1786 + print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
1787 + hash_base=>$hash, file_name=>$diff{'file'}),
1788 + -class => "list"}, esc_html($diff{'file'}));
1789 + print "</td>\n";
1790 + print "<td>$mode_chnge</td>\n";
1791 + print "<td class=\"link\">";
1792 if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
1793 if ($action eq 'commitdiff') {
1794 # link to patch
1795 $patchno++;
1815 - print " | " .
1816 - $cgi->a({-href => "#patch$patchno"}, "patch");
1796 + print $cgi->a({-href => "#patch$patchno"}, "patch");
1797 } else {
1818 - print " | " .
1819 - $cgi->a({-href => href(action=>"blobdiff",
1820 - hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1821 - hash_base=>$hash, hash_parent_base=>$parent,
1822 - file_name=>$diff{'file'})},
1823 - "diff");
1798 + print $cgi->a({-href => href(action=>"blobdiff",
1799 + hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
1800 + hash_base=>$hash, hash_parent_base=>$parent,
1801 + file_name=>$diff{'file'})},
1802 + "diff");
1803 }
1804 + print " | ";
1805 }
1826 - print " | " .
1827 - $cgi->a({-href => href(action=>"history",
1828 - hash_base=>$hash, file_name=>$diff{'file'})},
1829 - "history");
1806 + print $cgi->a({-href => href(action=>"history",
1807 + hash_base=>$hash, file_name=>$diff{'file'})},
1808 + "history");
1809 print "</td>\n";
1810
1811 } elsif ($diff{'status'} eq "R" || $diff{'status'} eq "C") { # renamed or copied
@@ -1846,10 +1825,7 @@ sub git_difftree_body {
1825 hash=>$diff{'from_id'}, file_name=>$diff{'from_file'}),
1826 -class => "list"}, esc_html($diff{'from_file'})) .
1827 " with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" .
1849 - "<td class=\"link\">" .
1850 - $cgi->a({-href => href(action=>"blob", hash_base=>$hash,
1851 - hash=>$diff{'to_id'}, file_name=>$diff{'to_file'})},
1852 - "blob");
1828 + "<td class=\"link\">";
1829 if ($diff{'to_id'} ne $diff{'from_id'}) {
1830 if ($action eq 'commitdiff') {
1831 # link to patch