@matheusbsbs / matheus-bagliano / commits / 6dd36acd32
Fork 0

gitweb: "alternate" starts with shade (i.e. 1)

When displaying a list of rows (difftree, shortlog, etc), the first entry is now printed shaded, i.e. alternate is initialized to 1, as opposed to non-shaded (alternate initialized to 0). This solves the problem when there is only one row to display -- it is displayed shaded to visually indicate that it is "active", part of a "list", etc. (Compare this to the trivial case of more than one entry, where the rows have alternating shade, thus suggesting being part of a "list" of "active" entries, etc.) Signed-off-by: Luben Tuikov <ltuikov@yahoo.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Luben Tuikov committed Sep 28, 2006 at 16:47 UTC 6dd36acd32476a474a5b7d2ad309a82c84513abe
1 file changed +8 -8
gitweb/gitweb.perl
+8 -8
@@ -1699,7 +1699,7 @@ sub git_difftree_body {
1699 print "</div>\n";
1700
1701 print "<table class=\"diff_tree\">\n";
1702 - my $alternate = 0;
1702 + my $alternate = 1;
1703 my $patchno = 0;
1704 foreach my $line (@{$difftree}) {
1705 my %diff = parse_difftree_raw_line($line);
@@ -1993,7 +1993,7 @@ sub git_shortlog_body {
1993 $to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);
1994
1995 print "<table class=\"shortlog\" cellspacing=\"0\">\n";
1996 - my $alternate = 0;
1996 + my $alternate = 1;
1997 for (my $i = $from; $i <= $to; $i++) {
1998 my $commit = $revlist->[$i];
1999 #my $ref = defined $refs ? format_ref_marker($refs, $commit) : '';
@@ -2035,7 +2035,7 @@ sub git_history_body {
2035 $to = $#{$revlist} unless (defined $to && $to <= $#{$revlist});
2036
2037 print "<table class=\"history\" cellspacing=\"0\">\n";
2038 - my $alternate = 0;
2038 + my $alternate = 1;
2039 for (my $i = $from; $i <= $to; $i++) {
2040 if ($revlist->[$i] !~ m/^([0-9a-fA-F]{40})/) {
2041 next;
@@ -2099,7 +2099,7 @@ sub git_tags_body {
2099 $to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);
2100
2101 print "<table class=\"tags\" cellspacing=\"0\">\n";
2102 - my $alternate = 0;
2102 + my $alternate = 1;
2103 for (my $i = $from; $i <= $to; $i++) {
2104 my $entry = $taglist->[$i];
2105 my %tag = %$entry;
@@ -2159,7 +2159,7 @@ sub git_heads_body {
2159 $to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);
2160
2161 print "<table class=\"heads\" cellspacing=\"0\">\n";
2162 - my $alternate = 0;
2162 + my $alternate = 1;
2163 for (my $i = $from; $i <= $to; $i++) {
2164 my $entry = $headlist->[$i];
2165 my %tag = %$entry;
@@ -2275,7 +2275,7 @@ sub git_project_list {
2275 }
2276 print "<th></th>\n" .
2277 "</tr>\n";
2278 - my $alternate = 0;
2278 + my $alternate = 1;
2279 foreach my $pr (@projects) {
2280 if ($alternate) {
2281 print "<tr class=\"dark\">\n";
@@ -2793,7 +2793,7 @@ sub git_tree {
2793 git_print_page_path($file_name, 'tree', $hash_base);
2794 print "<div class=\"page_body\">\n";
2795 print "<table cellspacing=\"0\">\n";
2796 - my $alternate = 0;
2796 + my $alternate = 1;
2797 foreach my $line (@entries) {
2798 my %t = parse_ls_tree_line($line, -z => 1);
2799
@@ -3389,7 +3389,7 @@ sub git_search {
3389 git_print_header_div('commit', esc_html($co{'title'}), $hash);
3390
3391 print "<table cellspacing=\"0\">\n";
3392 - my $alternate = 0;
3392 + my $alternate = 1;
3393 if ($commit_search) {
3394 $/ = "\0";
3395 open my $fd, "-|", git_cmd(), "rev-list", "--header", "--parents", $hash or next;