Skip to content

Commit

Permalink
gitweb: Add history and blame to git_difftree_body()
Browse files Browse the repository at this point in the history
Add blame and history to Deleted files.
Add blame and history to Modified or Type changed files.
Add blame and history to Renamed or Copied files.

This allows us to do
	blame->commit->blame->commit->blame->...
instead of
	blame->commit->file->blame->commit->file->blame->...
which is longer and easier to get wrong.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Luben Tuikov authored and Junio C Hamano committed Sep 28, 2006
1 parent 499faed commit eb51ec9
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -1761,9 +1761,12 @@ sub git_difftree_body {
print $cgi->a({-href => "#patch$patchno"}, "patch");
print " | ";
}
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
file_name=>$diff{'file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'file'})},
"history");
file_name=>$diff{'file'})},
"history");
print "</td>\n";

} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
Expand Down Expand Up @@ -1803,8 +1806,11 @@ sub git_difftree_body {
}
print " | ";
}
print $cgi->a({-href => href(action=>"history",
hash_base=>$hash, file_name=>$diff{'file'})},
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
file_name=>$diff{'file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
file_name=>$diff{'file'})},
"history");
print "</td>\n";

Expand All @@ -1830,17 +1836,22 @@ sub git_difftree_body {
if ($action eq 'commitdiff') {
# link to patch
$patchno++;
print " | " .
$cgi->a({-href => "#patch$patchno"}, "patch");
print $cgi->a({-href => "#patch$patchno"}, "patch");
} else {
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{'to_file'}, file_parent=>$diff{'from_file'})},
"diff");
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{'to_file'}, file_parent=>$diff{'from_file'})},
"diff");
}
print " | ";
}
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
file_name=>$diff{'from_file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'from_file'})},
"history");
print "</td>\n";

} # we should not encounter Unmerged (U) or Unknown (X) status
Expand Down

0 comments on commit eb51ec9

Please sign in to comment.