diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-27 15:33:26 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-27 15:33:26 -0800 |
commit | e22c522730b0fc1dd2a1f12b6e508c5fb2e0fe6c (patch) | |
tree | 44d2eb29376487ec18f0c7fde66595a78e76db61 | |
parent | bdf26fcbeabec0c2a785e5b14b9f3b4079cab0ea (diff) | |
parent | fd49e56af68fbdc19a4dc72ca1cf811a239df595 (diff) | |
download | git-e22c522730b0fc1dd2a1f12b6e508c5fb2e0fe6c.tar.gz git-e22c522730b0fc1dd2a1f12b6e508c5fb2e0fe6c.tar.xz |
Merge branch 'jn/gitweb-unborn-head' into maint
* jn/gitweb-unborn-head:
gitweb: Fix "heads" view when there is no current branch
-rwxr-xr-x | gitweb/gitweb.perl | 4 | ||||
-rwxr-xr-x | t/t9500-gitweb-standalone-no-errors.sh | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index c876e0fb4..d5dbd6428 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -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 { diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 3e4fdbe56..858a649cb 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -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 |