diff --git a/Cargo.lock b/Cargo.lock index 4e8df11306..852078c590 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2447,6 +2447,7 @@ dependencies = [ "gitbutler-url", "gitbutler-user", "gix", + "itertools 0.13.0", "log", "resolve-path", "serde", diff --git a/apps/desktop/src/lib/commit/CommitCard.svelte b/apps/desktop/src/lib/commit/CommitCard.svelte index 8266aa3648..6fc9530227 100644 --- a/apps/desktop/src/lib/commit/CommitCard.svelte +++ b/apps/desktop/src/lib/commit/CommitCard.svelte @@ -4,10 +4,12 @@ import { BaseBranch } from '$lib/baseBranch/baseBranch'; import CommitMessageInput from '$lib/commit/CommitMessageInput.svelte'; import { persistedCommitMessage } from '$lib/config/config'; + import { featureBranchStacking } from '$lib/config/uiFeatureFlags'; import { draggableCommit } from '$lib/dragging/draggable'; import { DraggableCommit, nonDraggable } from '$lib/dragging/draggables'; import BranchFilesList from '$lib/file/BranchFilesList.svelte'; import { ModeService } from '$lib/modes/service'; + import TextBox from '$lib/shared/TextBox.svelte'; import { copyToClipboard } from '$lib/utils/clipboard'; import { getContext, getContextStore, maybeGetContext } from '$lib/utils/context'; import { openExternalUrl } from '$lib/utils/url'; @@ -48,6 +50,8 @@ const currentCommitMessage = persistedCommitMessage(project.id, branch?.id || ''); + const branchStacking = featureBranchStacking(); + let draggableCommitElement: HTMLElement | null = null; let files: RemoteFile[] = []; let showDetails = false; @@ -82,6 +86,20 @@ let commitMessageValid = false; let description = ''; + let createRefModal: Modal; + let createRefName = $baseBranch.remoteName + '/'; + + function openCreateRefModal(e: Event, commit: DetailedCommit | Commit) { + e.stopPropagation(); + createRefModal.show(commit); + } + + function pushCommitRef(commit: DetailedCommit) { + if (branch && commit.remoteRef) { + branchController.pushChangeReference(branch.id, commit.remoteRef); + } + } + function openCommitMessageModal(e: Event) { e.stopPropagation(); @@ -156,6 +174,29 @@ {/snippet} + + {#snippet children(commit)} + + + {/snippet} + {#snippet controls(close)} + + {/snippet} + +
{getTimeAndAuthor()} + + {#if $branchStacking && commit instanceof DetailedCommit} +
+ {commit?.remoteRef} +
+ {/if}
{/if} @@ -352,6 +401,26 @@ icon="edit-small" onclick={openCommitMessageModal}>Edit message + {#if $branchStacking && commit instanceof DetailedCommit && !commit.remoteRef} + + {/if} + {#if $branchStacking && commit instanceof DetailedCommit && commit.remoteRef} + + {/if} {/if} {#if canEdit() && project.succeedingRebases}