Skip to content

Commit 7f92983

Browse files
committed
Show remote branch using name instead of sha
- multiple branches can have the same sha
1 parent 7073308 commit 7f92983

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

app/src/lib/branches/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class CombinedBranch {
3131
}
3232

3333
get displayName(): string {
34-
return this.pr?.title || this.remoteBranch?.displayName || this.vbranch?.name || 'unknown';
34+
return this.remoteBranch?.displayName || this.vbranch?.name || 'unknown';
3535
}
3636

3737
get authors(): Author[] {

app/src/lib/components/RemoteBranchPreview.svelte

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@
5454
<ScrollableContainer wide>
5555
<div class="branch-preview">
5656
<BranchPreviewHeader base={$baseBranch} {branch} {pr} />
57-
{#if pr?.body}
57+
{#if pr}
5858
<div class="card">
59-
<div class="card__header text-base-body-14 text-semibold">PR Description</div>
60-
<div class="markdown card__content text-base-body-13">
61-
{@html marked.parse(pr.body, { renderer })}
62-
</div>
59+
<div class="card__header text-base-body-14 text-semibold">{pr.title}</div>
60+
{#if pr.body}
61+
<div class="markdown card__content text-base-body-13">
62+
{@html marked.parse(pr.body, { renderer })}
63+
</div>
64+
{/if}
6365
</div>
6466
{/if}
6567
{#await getRemoteBranchData(project.id, branch.name) then branchData}

app/src/lib/navigation/BranchItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
function getBranchLink(b: CombinedBranch): string | undefined {
1212
if (b.vbranch?.active) return `/${projectId}/board/`;
1313
if (b.vbranch) return `/${projectId}/stashed/${b.vbranch.id}`;
14-
if (b.remoteBranch) return `/${projectId}/remote/${branch?.remoteBranch?.sha}`;
14+
if (b.remoteBranch) return `/${projectId}/remote/${branch?.displayName}`;
1515
if (b.pr) return `/${projectId}/pull/${b.pr.number}`;
1616
}
1717

app/src/routes/[projectId]/remote/[sha]/+page.svelte renamed to app/src/routes/[projectId]/remote/[...name]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
1717
$: ({ error, branches } = data.remoteBranchService);
1818
19-
$: branch = $branches?.find((b) => b.sha === $page.params.sha);
19+
$: branch = $branches?.find((b) => b.displayName === $page.params.name);
2020
$: pr = branch && githubService.getListedPr(branch.sha);
2121
</script>
2222

0 commit comments

Comments
 (0)