{"thread":{"id":"5749","subject":"[PATCH] gitweb: \"alternate\" starts with shade (i.e. 1)","startedAt":"2006-09-28T23:47:50Z","lastAt":"2006-09-28T23:47:50Z","messageCount":1,"participants":["Luben Tuikov"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27952","messageId":"20060928234750.47448.qmail@web31802.mail.mud.yahoo.com","threadId":"5749","inReplyTo":null,"subject":"[PATCH] gitweb: \"alternate\" starts with shade (i.e. 1)","fromName":"Luben Tuikov","fromEmail":"ltuikov@yahoo.com","sentAt":"2006-09-28T23:47:50Z","receivedAt":"2006-09-28T23:47:50Z","isPatch":true,"sender":{"key":"ltuikov@yahoo.com","avatar":null},"body":"When displaying a list of rows (difftree, shortlog, etc),\nthe first entry is now printed shaded, i.e. alternate is\ninitialized to 1, as opposed to non-shaded (alternate\ninitialized to 0).\n\nThis solves the problem when there is only one row to\ndisplay -- it is displayed shaded to visually indicate that\nit is \"active\", part of a \"list\", etc.\n\n(Compare this to the trivial case of more than one entry,\nwhere the rows have alternating shade, thus suggesting\nbeing part of a \"list\" of \"active\" entries, etc.)\n\nSigned-off-by: Luben Tuikov <ltuikov@yahoo.com>\n---\n gitweb/gitweb.perl |   16 ++++++++--------\n 1 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex afffbbe..79c8052 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -1699,7 +1699,7 @@ sub git_difftree_body {\n \tprint \"</div>\\n\";\n \n \tprint \"<table class=\\\"diff_tree\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tmy $patchno = 0;\n \tforeach my $line (@{$difftree}) {\n \t\tmy %diff = parse_difftree_raw_line($line);\n@@ -1993,7 +1993,7 @@ sub git_shortlog_body {\n \t$to = $#{$revlist} if (!defined $to || $#{$revlist} < $to);\n \n \tprint \"<table class=\\\"shortlog\\\" cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tmy $commit = $revlist->[$i];\n \t\t#my $ref = defined $refs ? format_ref_marker($refs, $commit) : '';\n@@ -2035,7 +2035,7 @@ sub git_history_body {\n \t$to = $#{$revlist} unless (defined $to && $to <= $#{$revlist});\n \n \tprint \"<table class=\\\"history\\\" cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tif ($revlist->[$i] !~ m/^([0-9a-fA-F]{40})/) {\n \t\t\tnext;\n@@ -2099,7 +2099,7 @@ sub git_tags_body {\n \t$to = $#{$taglist} if (!defined $to || $#{$taglist} < $to);\n \n \tprint \"<table class=\\\"tags\\\" cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tmy $entry = $taglist->[$i];\n \t\tmy %tag = %$entry;\n@@ -2159,7 +2159,7 @@ sub git_heads_body {\n \t$to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);\n \n \tprint \"<table class=\\\"heads\\\" cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tfor (my $i = $from; $i <= $to; $i++) {\n \t\tmy $entry = $headlist->[$i];\n \t\tmy %tag = %$entry;\n@@ -2275,7 +2275,7 @@ sub git_project_list {\n \t}\n \tprint \"<th></th>\\n\" .\n \t      \"</tr>\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tforeach my $pr (@projects) {\n \t\tif ($alternate) {\n \t\t\tprint \"<tr class=\\\"dark\\\">\\n\";\n@@ -2793,7 +2793,7 @@ sub git_tree {\n \tgit_print_page_path($file_name, 'tree', $hash_base);\n \tprint \"<div class=\\\"page_body\\\">\\n\";\n \tprint \"<table cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tforeach my $line (@entries) {\n \t\tmy %t = parse_ls_tree_line($line, -z => 1);\n \n@@ -3389,7 +3389,7 @@ sub git_search {\n \tgit_print_header_div('commit', esc_html($co{'title'}), $hash);\n \n \tprint \"<table cellspacing=\\\"0\\\">\\n\";\n-\tmy $alternate = 0;\n+\tmy $alternate = 1;\n \tif ($commit_search) {\n \t\t$/ = \"\\0\";\n \t\topen my $fd, \"-|\", git_cmd(), \"rev-list\", \"--header\", \"--parents\", $hash or next;\n-- \n1.4.2.1.g05f0f\n\n"}]}