1090
}
1091
1092
# format marker of refs pointing to given object
1093
+
1094
+# the destination action is chosen based on object type and current context:
1095
+# - for annotated tags, we choose the tag view unless it's the current view
1096
+# already, in which case we go to shortlog view
1097
+# - for other refs, we keep the current view if we're in history, shortlog or
1098
+# log view, and select shortlog otherwise
1099
sub format_ref_marker {
1100
my ($refs, $id) = @_;
1101
my $markers = '';
1102
1103
if (defined $refs->{$id}) {
1104
foreach my $ref (@{$refs->{$id}}) {
1105
+ # this code exploits the fact that non-lightweight tags are the
1106
+ # only indirect objects, and that they are the only objects for which
1107
+ # we want to use tag instead of shortlog as action
1108
my ($type, $name) = qw();
1109
+ my $indirect = ($ref =~ s/\^\{\}$//);
1110
# e.g. tags/v2.6.11 or heads/next
1111
if ($ref =~ m!^(.*?)s?/(.*)$!) {
1112
$type = $1;
1116
$name = $ref;
1117
}
1118
1109
- $markers .= " <span class=\"$type\" title=\"$ref\">" .
1110
- esc_html($name) . "</span>";
1119
+ my $class = $type;
1120
+ $class .= " indirect" if $indirect;
1121
+
1122
+ my $dest_action = "shortlog";
1123
+
1124
+ if ($indirect) {
1125
+ $dest_action = "tag" unless $action eq "tag";
1126
+ } elsif ($action =~ /^(history|(short)?log)$/) {
1127
+ $dest_action = $action;
1128
+ }
1129
+
1130
+ my $dest = "";
1131
+ $dest .= "refs/" unless $ref =~ m!^refs/!;
1132
+ $dest .= $ref;
1133
+
1134
+ my $link = $cgi->a({
1135
+ -href => href(
1136
+ action=>$dest_action,
1137
+ hash=>$dest
1138
+ )}, $name);
1139
+
1140
+ $markers .= " <span class=\"$class\" title=\"$ref\">" .
1141
+ $link . "</span>";
1142
}
1143
}
1144
1949
1950
while (my $line = <$fd>) {
1951
chomp $line;
1921
- if ($line =~ m!^([0-9a-fA-F]{40})\srefs/($type/?[^^]+)!) {
1952
+ if ($line =~ m!^([0-9a-fA-F]{40})\srefs/($type.*)$!) {
1953
if (defined $refs{$1}) {
1954
push @{$refs{$1}}, $2;
1955
} else {