Skip to content

Commit

Permalink
Merge branch 'jn/gitweb-unborn-head' into maint
Browse files Browse the repository at this point in the history
* jn/gitweb-unborn-head:
  gitweb: Fix "heads" view when there is no current branch
  • Loading branch information
Junio C Hamano committed Feb 27, 2012
2 parents bdf26fc + fd49e56 commit e22c522
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gitweb/gitweb.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 {
Expand Down
9 changes: 9 additions & 0 deletions t/t9500-gitweb-standalone-no-errors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -770,4 +770,13 @@ test_expect_success \
'echo "\$projects_list_group_categories = 1;" >>gitweb_config.perl &&
gitweb_run'

# ----------------------------------------------------------------------
# unborn branches

test_expect_success \
'unborn HEAD: "summary" page (with "heads" subview)' \
'git checkout orphan_branch || git checkout --orphan orphan_branch &&
test_when_finished "git checkout master" &&
gitweb_run "p=.git;a=summary"'

test_done

0 comments on commit e22c522

Please sign in to comment.