Code

gitweb: Fix "heads" view when there is no current branch
[git.git] / gitweb / gitweb.perl
index abb5a79afce445c73693593d32cced0ccdb90fe3..a174c9d6c49ff1895c8f4e10f99bfc8c40b6d007 100755 (executable)
@@ -5568,7 +5568,7 @@ sub git_tags_body {
 
 sub git_heads_body {
        # uses global variable $project
-       my ($headlist, $head, $from, $to, $extra) = @_;
+       my ($headlist, $head_at, $from, $to, $extra) = @_;
        $from = 0 unless defined $from;
        $to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);
 
@@ -5577,7 +5577,7 @@ sub git_heads_body {
        for (my $i = $from; $i <= $to; $i++) {
                my $entry = $headlist->[$i];
                my %ref = %$entry;
-               my $curr = $ref{'id'} eq $head;
+               my $curr = defined $head_at && $ref{'id'} eq $head_at;
                if ($alternate) {
                        print "<tr class=\"dark\">\n";
                } else {