@matheusbsbs / matheus-bagliano / commits / f9f02d0129
Fork 0

gitweb: git_tree displays blame based on repository config

git_tree() will now conditionally display "blame" depending on how "gitweb.blame" variable is configured using "git-repo-config". Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luben Tuikov committed Aug 4, 2006 at 15:14 UTC f9f02d012927cba2264b948d16008ede025f7c71
1 file changed +6 -3
gitweb/gitweb.perl
+6 -3
@@ -1757,6 +1757,7 @@ sub git_tree {
1757 git_header_html();
1758 my $base_key = "";
1759 my $base = "";
1760 + my $have_blame = git_get_project_config_bool ('blame');
1761 if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
1762 $base_key = ";hb=$hash_base";
1763 git_page_nav('tree','', $hash_base);
@@ -1792,9 +1793,11 @@ sub git_tree {
1793 $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name"), -class => "list"}, esc_html($t_name)) .
1794 "</td>\n" .
1795 "<td class=\"link\">" .
1795 - $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
1796 -# " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
1797 - " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$t_hash;hb=$hash_base;f=$base$t_name")}, "history") .
1796 + $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob");
1797 + if ($have_blame) {
1798 + print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame");
1799 + }
1800 + print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$t_hash;hb=$hash_base;f=$base$t_name")}, "history") .
1801 " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") .
1802 "</td>\n";
1803 } elsif ($t_type eq "tree") {