diff --git a/gitbutler-ui/src/lib/components/CommitList.svelte b/gitbutler-ui/src/lib/components/CommitList.svelte index 9111e8a03..8b1af574e 100644 --- a/gitbutler-ui/src/lib/components/CommitList.svelte +++ b/gitbutler-ui/src/lib/components/CommitList.svelte @@ -25,10 +25,13 @@ $: headCommit = branch.commits[0]; $: commits = type == 'upstream' ? [] : branch.commits.filter((c) => c.status == type); + $: hasCommits = commits && commits.length > 0; + $: remoteRequiresForcePush = type === 'remote' && branch.requiresForce; + let expanded = true; -{#if commits && commits.length > 0} +{#if hasCommits || remoteRequiresForcePush }
{ diff --git a/gitbutler-ui/src/lib/components/PushButton.svelte b/gitbutler-ui/src/lib/components/PushButton.svelte index fd926ad3a..3d7887029 100644 --- a/gitbutler-ui/src/lib/components/PushButton.svelte +++ b/gitbutler-ui/src/lib/components/PushButton.svelte @@ -7,6 +7,7 @@ - { - dispatch('trigger', { action }); - }} -> - {$selection$?.label} - { - // TODO: Refactor to use generics if/when that works with Svelte - switch (e.detail?.id) { - case BranchAction.Push: - $preferredAction = BranchAction.Push; - break; - case BranchAction.Pr: - $preferredAction = BranchAction.Pr; - break; - case BranchAction.DraftPr: - $preferredAction = BranchAction.DraftPr; - break; - default: - toasts.error('Uknown branch action'); - } - dropDown.close(); - }} - > - - - - - - - +{#if isPr && requiresForcePush } + +{:else if !isPr } + { + dispatch('trigger', { action }); + }} + > + {$selection$?.label} + { + // TODO: Refactor to use generics if/when that works with Svelte + switch (e.detail?.id) { + case BranchAction.Push: + $preferredAction = BranchAction.Push; + break; + case BranchAction.Pr: + $preferredAction = BranchAction.Pr; + break; + case BranchAction.DraftPr: + $preferredAction = BranchAction.DraftPr; + break; + default: + toasts.error('Uknown branch action'); + } + dropDown.close(); + }} + > + + + + + + + +{/if}