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>
maint
Luben Tuikov 2006-09-27 17:23:25 -07:00 committed by Junio C Hamano
parent 709f898dae
commit 499faeda1b
1 changed files with 34 additions and 58 deletions

View File

@ -1732,47 +1732,39 @@ sub git_difftree_body {
my $mode_chng = "<span class=\"file_status new\">[new $to_file_type"; my $mode_chng = "<span class=\"file_status new\">[new $to_file_type";
$mode_chng .= " with mode: $to_mode_str" if $to_mode_str; $mode_chng .= " with mode: $to_mode_str" if $to_mode_str;
$mode_chng .= "]</span>"; $mode_chng .= "]</span>";
print "<td>" . print "<td>";
$cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'}, print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'}), hash_base=>$hash, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'})) . -class => "list"}, esc_html($diff{'file'}));
"</td>\n" . print "</td>\n";
"<td>$mode_chng</td>\n" . print "<td>$mode_chng</td>\n";
"<td class=\"link\">" . print "<td class=\"link\">";
$cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'})},
"blob");
if ($action eq 'commitdiff') { if ($action eq 'commitdiff') {
# link to patch # link to patch
$patchno++; $patchno++;
print " | " . print $cgi->a({-href => "#patch$patchno"}, "patch");
$cgi->a({-href => "#patch$patchno"}, "patch");
} }
print "</td>\n"; print "</td>\n";


} elsif ($diff{'status'} eq "D") { # deleted } elsif ($diff{'status'} eq "D") { # deleted
my $mode_chng = "<span class=\"file_status deleted\">[deleted $from_file_type]</span>"; my $mode_chng = "<span class=\"file_status deleted\">[deleted $from_file_type]</span>";
print "<td>" . print "<td>";
$cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'}, print $cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
hash_base=>$parent, file_name=>$diff{'file'}), hash_base=>$parent, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'})) . -class => "list"}, esc_html($diff{'file'}));
"</td>\n" . print "</td>\n";
"<td>$mode_chng</td>\n" . print "<td>$mode_chng</td>\n";
"<td class=\"link\">" . print "<td class=\"link\">";
$cgi->a({-href => href(action=>"blob", hash=>$diff{'from_id'},
hash_base=>$parent, file_name=>$diff{'file'})},
"blob") .
" | ";
if ($action eq 'commitdiff') { if ($action eq 'commitdiff') {
# link to patch # link to patch
$patchno++; $patchno++;
print " | " . print $cgi->a({-href => "#patch$patchno"}, "patch");
$cgi->a({-href => "#patch$patchno"}, "patch"); print " | ";
} }
print $cgi->a({-href => href(action=>"history", hash_base=>$parent, print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'file'})}, file_name=>$diff{'file'})},
"history") . "history");
"</td>\n"; print "</td>\n";


} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed } elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
my $mode_chnge = ""; my $mode_chnge = "";
@ -1791,40 +1783,27 @@ sub git_difftree_body {
$mode_chnge .= "]</span>\n"; $mode_chnge .= "]</span>\n";
} }
print "<td>"; print "<td>";
if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'}));
} else { # only mode changed
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'}, print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'}), hash_base=>$hash, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'})); -class => "list"}, esc_html($diff{'file'}));
} print "</td>\n";
print "</td>\n" . print "<td>$mode_chnge</td>\n";
"<td>$mode_chnge</td>\n" . print "<td class=\"link\">";
"<td class=\"link\">" .
$cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'})},
"blob");
if ($diff{'to_id'} ne $diff{'from_id'}) { # modified if ($diff{'to_id'} ne $diff{'from_id'}) { # modified
if ($action eq 'commitdiff') { if ($action eq 'commitdiff') {
# link to patch # link to patch
$patchno++; $patchno++;
print " | " . print $cgi->a({-href => "#patch$patchno"}, "patch");
$cgi->a({-href => "#patch$patchno"}, "patch");
} else { } else {
print " | " . print $cgi->a({-href => href(action=>"blobdiff",
$cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'}, hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent, hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'})}, file_name=>$diff{'file'})},
"diff"); "diff");
} }
print " | ";
} }
print " | " . print $cgi->a({-href => href(action=>"history",
$cgi->a({-href => href(action=>"history",
hash_base=>$hash, file_name=>$diff{'file'})}, hash_base=>$hash, file_name=>$diff{'file'})},
"history"); "history");
print "</td>\n"; print "</td>\n";
@ -1846,10 +1825,7 @@ sub git_difftree_body {
hash=>$diff{'from_id'}, file_name=>$diff{'from_file'}), hash=>$diff{'from_id'}, file_name=>$diff{'from_file'}),
-class => "list"}, esc_html($diff{'from_file'})) . -class => "list"}, esc_html($diff{'from_file'})) .
" with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" . " with " . (int $diff{'similarity'}) . "% similarity$mode_chng]</span></td>\n" .
"<td class=\"link\">" . "<td class=\"link\">";
$cgi->a({-href => href(action=>"blob", hash_base=>$hash,
hash=>$diff{'to_id'}, file_name=>$diff{'to_file'})},
"blob");
if ($diff{'to_id'} ne $diff{'from_id'}) { if ($diff{'to_id'} ne $diff{'from_id'}) {
if ($action eq 'commitdiff') { if ($action eq 'commitdiff') {
# link to patch # link to patch