From 64ee34e0a9fad9e1da82a60078402dd2dfe20589 Mon Sep 17 00:00:00 2001 From: Kiril Videlov Date: Sat, 17 Feb 2024 21:13:02 +0100 Subject: [PATCH] feat: update projectCurrentCommitMessage function to include branchId parameter and use it in relevant places --- gitbutler-ui/src/lib/components/CommitCard.svelte | 8 ++++---- gitbutler-ui/src/lib/components/CommitDialog.svelte | 7 ++----- .../src/lib/components/CommitListItem.svelte | 1 + gitbutler-ui/src/lib/config/config.ts | 12 +++++------- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/gitbutler-ui/src/lib/components/CommitCard.svelte b/gitbutler-ui/src/lib/components/CommitCard.svelte index 89f22a705..5c1a7a1da 100644 --- a/gitbutler-ui/src/lib/components/CommitCard.svelte +++ b/gitbutler-ui/src/lib/components/CommitCard.svelte @@ -3,7 +3,7 @@ import Button from '$lib/components/Button.svelte'; import Tag from '$lib/components/Tag.svelte'; import TimeAgo from '$lib/components/TimeAgo.svelte'; - import { projectCurrentCommitMessage, projectLastCommitMessage } from '$lib/config/config'; + import { projectCurrentCommitMessage } from '$lib/config/config'; import { draggable } from '$lib/dragging/draggable'; import { draggableCommit, nonDraggable } from '$lib/dragging/draggables'; import { openExternalUrl } from '$lib/utils/url'; @@ -20,10 +20,10 @@ export let resetHeadCommit: () => void | undefined = () => undefined; export let isUnapplied = false; export let selectedFiles: Writable<(LocalFile | RemoteFile)[]>; + export let branchId: string | undefined = undefined; const selectedOwnership = writable(Ownership.default()); - const currentCommitMessage = projectCurrentCommitMessage(projectId); - const lastCommitMessage = projectLastCommitMessage(projectId); + const currentCommitMessage = projectCurrentCommitMessage(projectId, branchId || ''); let showFiles = false; @@ -58,7 +58,7 @@ border clickable on:click={(e) => { - currentCommitMessage.set($lastCommitMessage); + currentCommitMessage.set(commit.description); e.stopPropagation(); resetHeadCommit(); }}>Undo(false, 'commitBoxExpanded_' + branch.id); let commitMessage: string = get(currentCommitMessage) || ''; @@ -64,7 +62,6 @@ branchController .commitBranch(branch.id, commitMessage, $selectedOwnership.toString(), $runCommitHooks) .then(() => { - lastCommitMessage.set(commitMessage); commitMessage = ''; currentCommitMessage.set(''); }) diff --git a/gitbutler-ui/src/lib/components/CommitListItem.svelte b/gitbutler-ui/src/lib/components/CommitListItem.svelte index edc2b8c18..0ea662a2d 100644 --- a/gitbutler-ui/src/lib/components/CommitListItem.svelte +++ b/gitbutler-ui/src/lib/components/CommitListItem.svelte @@ -146,6 +146,7 @@ {resetHeadCommit} {isUnapplied} {selectedFiles} + branchId={branch.id} />