Skip to content

Commit 5609586

Browse files
committed
Merge branch 'jn/gitweb-unborn-head'
* jn/gitweb-unborn-head: gitweb: Fix "heads" view when there is no current branch
2 parents d30146a + fd49e56 commit 5609586

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

gitweb/gitweb.perl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5633,7 +5633,7 @@ sub git_tags_body {
56335633

56345634
sub git_heads_body {
56355635
# uses global variable $project
5636-
my ($headlist, $head, $from, $to, $extra) = @_;
5636+
my ($headlist, $head_at, $from, $to, $extra) = @_;
56375637
$from = 0 unless defined $from;
56385638
$to = $#{$headlist} if (!defined $to || $#{$headlist} < $to);
56395639

@@ -5642,7 +5642,7 @@ sub git_heads_body {
56425642
for (my $i = $from; $i <= $to; $i++) {
56435643
my $entry = $headlist->[$i];
56445644
my %ref = %$entry;
5645-
my $curr = $ref{'id'} eq $head;
5645+
my $curr = defined $head_at && $ref{'id'} eq $head_at;
56465646
if ($alternate) {
56475647
print "<tr class=\"dark\">\n";
56485648
} else {

t/t9500-gitweb-standalone-no-errors.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,4 +778,13 @@ test_expect_success \
778778
'echo "\$projects_list_group_categories = 1;" >>gitweb_config.perl &&
779779
gitweb_run'
780780

781+
# ----------------------------------------------------------------------
782+
# unborn branches
783+
784+
test_expect_success \
785+
'unborn HEAD: "summary" page (with "heads" subview)' \
786+
'git checkout orphan_branch || git checkout --orphan orphan_branch &&
787+
test_when_finished "git checkout master" &&
788+
gitweb_run "p=.git;a=summary"'
789+
781790
test_done

0 commit comments

Comments
 (0)