Default default branch not being found

We default to the first branch.

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-03-30 14:05:58 +02:00
parent a84b5d0ec0
commit ebeac8d9b4
2 changed files with 9 additions and 1 deletions
+3
View File
@@ -144,13 +144,16 @@
bind:peersDropdown={dropdownState.peer}
on:peerChanged={(event) => updatePeer(event.detail)} />
{/if}
<BranchSelector {branches} {project} {revision} {toggleDropdown}
bind:branchesDropdown={dropdownState.branch}
on:branchChanged={(event) => updateRevision(event.detail)} />
<div class="anchor">
<AnchorBadge {commit} {anchors}
head={project.head} on:click={(event) => updateRevision(event.detail)} />
</div>
{#if seed.git.host}
<span>
<div class="clone" on:click={() => toggleDropdown("clone")}>
+6 -1
View File
@@ -29,8 +29,13 @@
if (revision) browse.revision = revision;
} else if (revision) {
browse.revision = revision;
} else {
} else if (head) {
browse.revision = head;
} else {
const branchNames = Object.keys(project.branches);
const firstBranch = branchNames.length >= 1 ? branchNames[0] : null;
browse.revision = firstBranch;
}
$: proj.browse({ ...browse, peer });