Skip to content

Commit 9e1fbaf

Browse files
authored
Merge pull request #10406 from gitbutlerapp/copilot/fix-6bea0204-7557-4d3a-a1a5-92fe21fe0869
Fix CommitTitle to show context-appropriate messages for empty commits
2 parents 68f9ea7 + 4a3c61e commit 9e1fbaf

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

apps/desktop/src/components/BranchCommitList.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@
272272
{active}
273273
onclick={() => handleCommitClick(commit.id, true)}
274274
disableCommitActions={false}
275+
editable={!!stackId}
275276
/>
276277
{/if}
277278
{/each}
@@ -414,6 +415,7 @@
414415
{active}
415416
onclick={() => handleCommitClick(commit.id, false)}
416417
disableCommitActions={false}
418+
editable={!!stackId}
417419
>
418420
{#snippet menu({ rightClickTrigger })}
419421
{@const data = {

apps/desktop/src/components/CommitRow.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
active?: boolean;
2828
hasConflicts?: boolean;
2929
disabled?: boolean;
30+
editable?: boolean;
3031
menu?: Snippet<[{ rightClickTrigger: HTMLElement }]>;
3132
onclick?: () => void;
3233
};
@@ -74,6 +75,7 @@
7475
disabled,
7576
hasConflicts,
7677
active,
78+
editable,
7779
onclick,
7880
menu,
7981
...args
@@ -146,7 +148,7 @@
146148
{/if}
147149

148150
<div class="commit-name truncate">
149-
<CommitTitle {commitMessage} truncate className="text-13 text-semibold" />
151+
<CommitTitle {commitMessage} truncate className="text-13 text-semibold" {editable} />
150152
</div>
151153

152154
{#if !args.disableCommitActions}

apps/desktop/src/components/CommitTitle.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66
truncate?: boolean;
77
commitMessage: string;
88
className?: string;
9+
editable?: boolean;
910
};
1011
11-
const { commitMessage, truncate, className }: Props = $props();
12+
const { commitMessage, truncate, className, editable }: Props = $props();
1213
1314
const title = $derived(splitMessage(commitMessage).title);
1415
1516
function getTitle() {
1617
if (title) {
1718
return title;
1819
}
19-
return 'Empty commit. Drag changes here';
20+
return editable ? 'Empty commit. Drag changes here' : 'Empty commit';
2021
}
2122
</script>
2223

apps/desktop/src/components/CommitView.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@
166166
truncate
167167
commitMessage={commit.message}
168168
className="text-14 text-semibold text-body"
169+
editable={!isReadOnly}
169170
/>
170171
{/snippet}
171172

0 commit comments

Comments
 (0)