Merge branch 'jn/gitweb-unborn-head'
authorJunio C Hamano <gitster@pobox.com>
Tue, 21 Feb 2012 23:25:53 +0000 (15:25 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 21 Feb 2012 23:25:53 +0000 (15:25 -0800)
* jn/gitweb-unborn-head:
gitweb: Fix "heads" view when there is no current branch

gitweb/gitweb.perl
t/t9500-gitweb-standalone-no-errors.sh
index 16d376075ea8bb47271aaeffebacf56fd41e713b..b63a5c67aff0fd587da31b307c1154ec033950f1 100755 (executable)
@@ -5633,7 +5633,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);
 
@@ -5642,7 +5642,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 {
index 40a1cb571e4a6ac285398054962c139a316d4306..90bb6050c13ece02199b6978e43e3c67de563c84 100755 (executable)
@@ -778,4 +778,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