Hello, with the following patch there are different colours for tags and heads in gitweb. So you can easily differentiate between them. Commit ca9e3b124f6313187da641b5cd55100c4ade6a9a ---- diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css index 47c1ade..c47cbf4 100644 --- a/gitweb/gitweb.css +++ b/gitweb/gitweb.css @@ -330,6 +330,15 @@ span.tag { border-color: #ffffcc #ffee00 #ffee00 #ffffcc; } +span.head { + padding: 0px 4px; + font-size: 10px; + font-weight: normal; + background-color: #aaaaff; + border: 1px solid; + border-color: #ccccff #0033cc #0033cc #ccccff; +} + span.atnight { color: #cc0000; } diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 626fcc9..755b0b1 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -363,10 +363,10 @@ sub format_log_line_html { # format marker of refs pointing to given object sub git_get_referencing { - my ($refs, $id) = @_; + my ($refs, $id, $class) = @_; if (defined $refs->{$id}) { - return ' <span class="tag">' . esc_html($refs->{$id}) . '</span>'; + return " <span class=\"$class\">" . esc_html($refs->{$id}) . "</span>"; } else { return ""; } @@ -1054,7 +1054,7 @@ ## functions printing large fragments of sub git_shortlog_body { # uses global variable $project - my ($revlist, $from, $to, $refs, $extra) = @_; + my ($revlist, $from, $to, $refs, $heads, $extra) = @_; $from = 0 unless defined $from; $to = $#{$revlist} if (!defined $to || $#{$revlist} < $to); @@ -1062,8 +1062,9 @@ sub git_shortlog_body { my $alternate = 0; for (my $i = $from; $i <= $to; $i++) { my $commit = $revlist->[$i]; - #my $ref = defined $refs ? git_get_referencing($refs, $commit) : ''; - my $ref = git_get_referencing($refs, $commit); + #my $ref = defined $refs ? git_get_referencing($refs, $commit, "tag") : ''; + my $ref = git_get_referencing($refs, $commit, "tag"); + my $head = git_get_referencing($heads, $commit, "head"); my %co = git_read_commit($commit); if ($alternate) { print "<tr class=\"dark\">\n"; @@ -1078,11 +1079,11 @@ sub git_shortlog_body { if (length($co{'title_short'}) < length($co{'title'})) { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list", -title => "$co{'title'}"}, - "<b>" . esc_html($co{'title_short'}) . "$ref</b>"); + "<b>" . esc_html($co{'title_short'}) . "$ref $head</b>"); } else { print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, - "<b>" . esc_html($co{'title'}) . "$ref</b>"); + "<b>" . esc_html($co{'title'}) . "$ref $head</b>"); } print "</td>\n" . "<td class=\"link\">" . @@ -1407,7 +1408,8 @@ sub git_summary { $owner = get_file_owner("$projectroot/$project"); } - my $refs = read_info_ref(); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); git_header_html(); git_page_nav('summary','', $head); @@ -1423,7 +1425,7 @@ sub git_summary { my @revlist = map { chomp; $_ } <$fd>; close $fd; git_header_div('shortlog'); - git_shortlog_body(\@revlist, 0, 15, $refs, + git_shortlog_body(\@revlist, 0, 15, $refs, $heads, $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "...")); my $taglist = git_read_refs("refs/tags"); @@ -1746,8 +1748,10 @@ sub git_tree { close $fd or die_error(undef, "Reading tree failed"); $/ = "\n"; - my $refs = read_info_ref(); - my $ref = git_get_referencing($refs, $hash_base); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); + my $ref = git_get_referencing($refs, $hash_base, "tag"); + my $head = git_get_referencing($heads, $hash_base, "head"); git_header_html(); my $base_key = ""; my $base = ""; @@ -1755,7 +1759,7 @@ sub git_tree { if (defined $hash_base && (my %co = git_read_commit($hash_base))) { $base_key = ";hb=$hash_base"; git_page_nav('tree','', $hash_base); - git_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base); + git_header_div('commit', esc_html($co{'title'}) . $ref . $head, $hash_base); } else { print "<div class=\"page_nav\">\n"; print "<br/><br/></div>\n"; @@ -1818,7 +1822,8 @@ sub git_log { if (!defined $page) { $page = 0; } - my $refs = read_info_ref(); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); my $limit = sprintf("--max-count=%i", (100 * ($page+1))); open my $fd, "-|", $GIT, "rev-list", $limit, $hash @@ -1839,13 +1844,14 @@ sub git_log { } for (my $i = ($page * 100); $i <= $#revlist; $i++) { my $commit = $revlist[$i]; - my $ref = git_get_referencing($refs, $commit); + my $ref = git_get_referencing($refs, $commit, "tag"); + my $head = git_get_referencing($heads, $commit, "head"); my %co = git_read_commit($commit); next if !%co; my %ad = date_str($co{'author_epoch'}); git_header_div('commit', "<span class=\"age\">$co{'age_string'}</span>" . - esc_html($co{'title'}) . $ref, + esc_html($co{'title'}) . $ref . $head, $commit); print "<div class=\"title_text\">\n" . "<div class=\"log_link\">\n" . @@ -1902,8 +1908,10 @@ sub git_commit { if ($hash =~ m/^[0-9a-fA-F]{40}$/) { $expires = "+1d"; } - my $refs = read_info_ref(); - my $ref = git_get_referencing($refs, $co{'id'}); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); + my $ref = git_get_referencing($refs, $co{'id'}, "tag"); + my $head = git_get_referencing($heads, $co{'id'}, "head"); my $formats_nav = ''; if (defined $file_name && defined $co{'parent'}) { my $parent = $co{'parent'}; @@ -1915,9 +1923,9 @@ sub git_commit { $formats_nav); if (defined $co{'parent'}) { - git_header_div('commitdiff', esc_html($co{'title'}) . $ref, $hash); + git_header_div('commitdiff', esc_html($co{'title'}) . $ref . $head, $hash); } else { - git_header_div('tree', esc_html($co{'title'}) . $ref, $co{'tree'}, $hash); + git_header_div('tree', esc_html($co{'title'}) . $ref . $head, $co{'tree'}, $hash); } print "<div class=\"title_text\">\n" . "<table cellspacing=\"0\">\n"; @@ -2126,13 +2134,15 @@ sub git_commitdiff { if ($hash =~ m/^[0-9a-fA-F]{40}$/) { $expires = "+1d"; } - my $refs = read_info_ref(); - my $ref = git_get_referencing($refs, $co{'id'}); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); + my $ref = git_get_referencing($refs, $co{'id'}, "tag"); + my $head = git_get_referencing($heads, $co{'id'}, "head"); my $formats_nav = $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain"); git_header_html(undef, $expires); git_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav); - git_header_div('commit', esc_html($co{'title'}) . $ref, $hash); + git_header_div('commit', esc_html($co{'title'}) . $ref . $head, $hash); print "<div class=\"page_body\">\n"; my $comment = $co{'comment'}; my $empty = 0; @@ -2271,7 +2281,8 @@ sub git_history { if (!%co) { die_error(undef, "Unknown commit object"); } - my $refs = read_info_ref(); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); git_header_html(); git_page_nav('','', $hash_base,$co{'tree'},$hash_base); git_header_div('commit', esc_html($co{'title'}), $hash_base); @@ -2294,7 +2305,8 @@ sub git_history { if (!%co) { next; } - my $ref = git_get_referencing($refs, $commit); + my $ref = git_get_referencing($refs, $commit, "tag"); + my $head = git_get_referencing($heads, $commit, "head"); if ($alternate) { print "<tr class=\"dark\">\n"; } else { @@ -2304,7 +2316,7 @@ sub git_history { print "<td title=\"$co{'age_string_age'}\"><i>$co{'age_string_date'}</i></td>\n" . "<td><i>" . esc_html(chop_str($co{'author_name'}, 15, 3)) . "</i></td>\n" . "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit"), -class => "list"}, "<b>" . - esc_html(chop_str($co{'title'}, 50)) . "$ref</b>") . "</td>\n" . + esc_html(chop_str($co{'title'}, 50)) . $ref . $head . "</b>") . "</td>\n" . "<td class=\"link\">" . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") . " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") . @@ -2468,7 +2480,8 @@ sub git_shortlog { if (!defined $page) { $page = 0; } - my $refs = read_info_ref(); + my $refs = read_info_ref("tags"); + my $heads = read_info_ref("heads"); my $limit = sprintf("--max-count=%i", (100 * ($page+1))); open my $fd, "-|", $GIT, "rev-list", $limit, $hash @@ -2489,7 +2502,7 @@ sub git_shortlog { git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav); git_header_div('summary', $project); - git_shortlog_body(\@revlist, ($page * 100), $#revlist, $refs, $next_link); + git_shortlog_body(\@revlist, ($page * 100), $#revlist, $refs, $heads, $next_link); git_footer_html(); } ---- Bye, Thomas -- Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer - : send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html