Skip to content

Commit 6d00ac1

Browse files
committed
Fix committing to bottom of a branch
We have a thing that checks the exclusive action is targeting a valid commit, but that validation needs to include `baseSha`.
1 parent f06f07e commit 6d00ac1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

apps/desktop/src/components/WorkspaceView.svelte

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import ReduxResult from '$components/ReduxResult.svelte';
77
import SelectionView from '$components/SelectionView.svelte';
88
import UnassignedView from '$components/UnassignedView.svelte';
9+
import BaseBranchService from '$lib/baseBranch/baseBranchService.svelte';
910
import { SettingsService } from '$lib/config/appSettingsV2';
1011
import {
1112
DefinedFocusable,
@@ -28,20 +29,17 @@
2829
2930
const { projectId }: Props = $props();
3031
31-
const [stackService, focusManager, idSelection, uiState, settingsService] = inject(
32-
StackService,
33-
FocusManager,
34-
IdSelection,
35-
UiState,
36-
SettingsService
37-
);
32+
const [stackService, focusManager, idSelection, uiState, settingsService, baseBranchService] =
33+
inject(StackService, FocusManager, IdSelection, UiState, SettingsService, BaseBranchService);
3834
const worktreeSelection = $derived(idSelection.getById({ type: 'worktree' }));
3935
const stacksResult = $derived(stackService.stacks(projectId));
4036
const projectState = $derived(uiState.project(projectId));
4137
const settingsStore = $derived(settingsService.appSettings);
4238
const canUseActions = $derived($settingsStore?.featureFlags.actions ?? false);
4339
const showingActions = $derived(projectState.showActions.current && canUseActions);
4440
const exclusiveAction = $derived(projectState.exclusiveAction.current);
41+
const baseBranchResult = $derived(baseBranchService.baseBranch(projectId));
42+
const baseSha = $derived(baseBranchResult.current.data?.baseSha);
4543
4644
const snapshotFocusables = writable<string[]>([]);
4745
setContext('snapshot-focusables', snapshotFocusables);
@@ -115,8 +113,10 @@
115113
return;
116114
}
117115
116+
// When we're committing to the bottom of the stack we set the
117+
// commit id to equal the workspace base.
118118
const hasCommit = branch.current.data.commits.some((c) => c.id === action.parentCommitId);
119-
if (!hasCommit) {
119+
if (!hasCommit && action.parentCommitId !== baseSha) {
120120
uiState.project(projectId).exclusiveAction.set(undefined);
121121
}
122122
});

0 commit comments

Comments
 (0)