Skip to content

Commit 516634c

Browse files
authored
Merge branch 'master' into add-troubleshooting-section
2 parents 434a9e3 + 2b8d543 commit 516634c

File tree

65 files changed

+529
-353
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+529
-353
lines changed

apps/desktop/cypress/e2e/review.cy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ describe('Review', () => {
183183
cy.getByTestId('create-review-box-title-input')
184184
.should('be.visible')
185185
.should('be.enabled')
186-
.should('have.value', mockBackend.getCommitTitle(stack.id))
186+
.should('have.value', mockBackend.getCommitTitle(stack.id!))
187187
.clear()
188188
.type(prTitle);
189189

190190
cy.getByTestId('create-review-box-description-input')
191191
.should('be.visible')
192-
.should('contain', mockBackend.getCommitMessage(stack.id))
192+
.should('contain', mockBackend.getCommitMessage(stack.id!))
193193
.click()
194194
.clear()
195195
.type(prDescription);
@@ -251,13 +251,13 @@ describe('Review', () => {
251251
cy.getByTestId('create-review-box-title-input')
252252
.should('be.visible')
253253
.should('be.enabled')
254-
.should('have.value', mockBackend.getCommitTitle(stack.id))
254+
.should('have.value', mockBackend.getCommitTitle(stack.id!))
255255
.clear()
256256
.type(prTitle);
257257

258258
cy.getByTestId('create-review-box-description-input')
259259
.should('be.visible')
260-
.should('contain', mockBackend.getCommitMessage(stack.id))
260+
.should('contain', mockBackend.getCommitMessage(stack.id!))
261261
.click()
262262
.clear()
263263
.type(prDescription);
@@ -333,7 +333,7 @@ describe('Review', () => {
333333
cy.getByTestId('create-review-box-title-input')
334334
.should('be.visible')
335335
.should('be.enabled')
336-
.should('have.value', mockBackend.getCommitTitle(stack.id));
336+
.should('have.value', mockBackend.getCommitTitle(stack.id!));
337337

338338
cy.getByTestId('create-review-box-template-toggle').click();
339339
enabledTemplates = true;
@@ -343,7 +343,7 @@ describe('Review', () => {
343343
cy.getByTestId('create-review-box-title-input')
344344
.should('be.visible')
345345
.should('be.enabled')
346-
.should('have.value', mockBackend.getCommitTitle(stack.id))
346+
.should('have.value', mockBackend.getCommitTitle(stack.id!))
347347
.clear()
348348
.type(prTitle);
349349

apps/desktop/cypress/e2e/selection.cy.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Selection', () => {
3737

3838
for (const stack of stacks) {
3939
const stackName = stack.heads[0]?.name;
40-
const stackId = stack.id;
40+
const stackId = stack.id!;
4141
if (!stackName) continue;
4242

4343
cy.getByTestIdByValue('branch-header', stackName)
@@ -51,7 +51,7 @@ describe('Selection', () => {
5151
.scrollIntoView()
5252
.should('be.visible')
5353
.within(() => {
54-
const changedFileNames = mockBackend.getBranchChangesFileNames(stack.id, stackName);
54+
const changedFileNames = mockBackend.getBranchChangesFileNames(stackId, stackName);
5555
for (const fileName of changedFileNames) {
5656
cy.getByTestId('file-list-item', fileName).should('be.visible');
5757
}
@@ -71,7 +71,7 @@ describe('Selection', () => {
7171
// Select the initial commit which should be local only
7272
cy.getByTestId('commit-row', 'Initial commit').first().click();
7373

74-
cy.getByTestIdByValue('stack', stack.id)
74+
cy.getByTestIdByValue('stack', stack.id!)
7575
.should('be.visible')
7676
.within(() => {
7777
cy.getByTestId('commit-drawer-title').should('contain', 'Initial commit');

apps/desktop/cypress/e2e/support/mock/settings.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ export const MOCK_FEATURE_FLAGS: FeatureFlags = {
1111
ws3: false,
1212
actions: false,
1313
butbot: false,
14-
rules: false
14+
rules: false,
15+
singleBranch: false
1516
};
1617

1718
export const MOCK_APP_SETTINGS: AppSettings = {

apps/desktop/cypress/e2e/unifiedDiffView.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ describe('Unified Diff View', () => {
5454
.should('contain', stackName)
5555
.click()
5656
.then(() => {
57-
cy.getByTestIdByValue('stack', stack.id)
57+
cy.getByTestIdByValue('stack', stack.id!)
5858
.should('be.visible')
5959
.within(() => {
6060
// Check if the file list is updated
61-
const changedFileNames = mockBackend.getBranchChangesFileNames(stack.id, stackName);
61+
const changedFileNames = mockBackend.getBranchChangesFileNames(stack.id!, stackName);
6262
for (const fileName of changedFileNames) {
6363
cy.getByTestId('file-list-item', fileName).should('be.visible').click();
6464
}

apps/desktop/src/components/BranchCard.svelte

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
interface StackBranchProps extends BranchCardProps {
5555
type: 'stack-branch';
5656
iconName: keyof typeof iconsJson;
57-
stackId: string;
57+
stackId?: string;
58+
laneId: string;
5859
selected: boolean;
5960
trackingBranch?: string;
6061
isNewBranch?: boolean;
@@ -98,10 +99,8 @@
9899
exclusiveAction.branchName === branchName
99100
);
100101
101-
const stackState = $derived(
102-
args.type === 'stack-branch' ? uiState.stack(args.stackId) : undefined
103-
);
104-
const selection = $derived(stackState ? stackState.selection.current : undefined);
102+
const laneState = $derived(args.type === 'stack-branch' ? uiState.lane(args.laneId) : undefined);
103+
const selection = $derived(laneState ? laneState.selection.current : undefined);
105104
const selected = $derived(selection?.branchName === branchName);
106105
const isPushed = $derived(!!(args.type === 'draft-branch' ? undefined : args.trackingBranch));
107106
@@ -113,9 +112,11 @@
113112
uiState.global.draftBranchName.set(normalized);
114113
}
115114
} else if (args.type === 'stack-branch') {
115+
if (!args.stackId) return;
116116
updateName({
117117
projectId,
118118
stackId: args.stackId,
119+
laneId: args.laneId,
119120
branchName,
120121
newName: title
121122
});
@@ -135,11 +136,15 @@
135136
data-testid={TestId.BranchCard}
136137
>
137138
{#if args.type === 'stack-branch'}
138-
{@const moveHandler = new MoveCommitDzHandler(stackService, args.stackId, projectId)}
139-
{#if !args.prNumber}
139+
{@const moveHandler = args.stackId
140+
? new MoveCommitDzHandler(stackService, args.stackId, projectId)
141+
: undefined}
142+
{#if !args.prNumber && args.stackId}
140143
<PrNumberUpdater {projectId} stackId={args.stackId} {branchName} />
141144
{/if}
142-
<Dropzone handlers={args.first ? [moveHandler, ...args.dropzones] : args.dropzones}>
145+
<Dropzone
146+
handlers={args.first && moveHandler ? [moveHandler, ...args.dropzones] : args.dropzones}
147+
>
143148
{#snippet overlay({ hovered, activated, handler })}
144149
{@const label =
145150
handler instanceof MoveCommitDzHandler

apps/desktop/src/components/BranchCommitList.svelte

Lines changed: 56 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import { inject } from '@gitbutler/shared/context';
3535
import { Button, Modal, TestId } from '@gitbutler/ui';
3636
import { getTimeAgo } from '@gitbutler/ui/utils/timeAgo';
37+
import { isDefined } from '@gitbutler/ui/utils/typeguards';
3738
import type { Commit } from '$lib/branches/v3';
3839
import type { CommitStatusType } from '$lib/commits/commit';
3940
import type { BranchDetails } from '$lib/stacks/stack';
@@ -60,7 +61,8 @@
6061
interface Props {
6162
active: boolean;
6263
projectId: string;
63-
stackId: string;
64+
stackId?: string;
65+
laneId: string;
6466
branchName: string;
6567
firstBranch: boolean;
6668
lastBranch: boolean;
@@ -82,6 +84,7 @@
8284
active,
8385
projectId,
8486
stackId,
87+
laneId,
8588
branchName,
8689
branchDetails,
8790
firstBranch,
@@ -108,8 +111,8 @@
108111
const isCommitting = $derived(
109112
exclusiveAction?.type === 'commit' && exclusiveAction.stackId === stackId
110113
);
111-
const stackState = $derived(uiState.stack(stackId));
112-
const selection = $derived(stackState.selection);
114+
const laneState = $derived(uiState.lane(laneId));
115+
const selection = $derived(laneState.selection);
113116
const runHooks = $derived(projectRunCommitHooks(projectId));
114117
115118
const selectedBranchName = $derived(selection.current?.branchName);
@@ -127,6 +130,7 @@
127130
let confirmResetModal = $state<ReturnType<typeof Modal>>();
128131
129132
async function integrate(strategy?: SeriesIntegrationStrategy): Promise<void> {
133+
if (!stackId) return;
130134
await integrateUpstreamCommits({
131135
projectId,
132136
stackId,
@@ -152,7 +156,7 @@
152156
153157
async function handleCommitClick(commitId: string, upstream: boolean) {
154158
if (selectedCommitId !== commitId) {
155-
stackState.selection.set({ branchName, commitId, upstream });
159+
laneState.selection.set({ branchName, commitId, upstream });
156160
}
157161
projectState.stackId.set(stackId);
158162
onselect?.();
@@ -315,35 +319,41 @@
315319
isIntegrated: isLocalAndRemoteCommit(commit) && commit.state.type === 'Integrated',
316320
hasConflicts: isLocalAndRemoteCommit(commit) && commit.hasConflicts,
317321
}}
318-
{@const amendHandler = new AmendCommitWithChangeDzHandler(
319-
projectId,
320-
stackService,
321-
hooksService,
322-
stackId,
323-
$runHooks,
324-
dzCommit,
325-
(newId) => uiState.stack(stackId).selection.set({ branchName, commitId: newId }),
326-
uiState
327-
)}
328-
{@const squashHandler = new SquashCommitDzHandler({
329-
stackService,
330-
projectId,
331-
stackId,
332-
commit: dzCommit
333-
})}
334-
{@const hunkHandler = new AmendCommitWithHunkDzHandler({
335-
stackService,
336-
hooksService,
337-
projectId,
338-
stackId,
339-
commit: dzCommit,
340-
runHooks: $runHooks,
341-
// TODO: Use correct value!
342-
okWithForce: true,
343-
uiState
344-
})}
322+
{@const amendHandler = stackId
323+
? new AmendCommitWithChangeDzHandler(
324+
projectId,
325+
stackService,
326+
hooksService,
327+
stackId,
328+
$runHooks,
329+
dzCommit,
330+
(newId) => uiState.lane(stackId).selection.set({ branchName, commitId: newId }),
331+
uiState
332+
)
333+
: undefined}
334+
{@const squashHandler = stackId
335+
? new SquashCommitDzHandler({
336+
stackService,
337+
projectId,
338+
stackId,
339+
commit: dzCommit
340+
})
341+
: undefined}
342+
{@const hunkHandler = stackId
343+
? new AmendCommitWithHunkDzHandler({
344+
stackService,
345+
hooksService,
346+
projectId,
347+
stackId,
348+
commit: dzCommit,
349+
runHooks: $runHooks,
350+
// TODO: Use correct value!
351+
okWithForce: true,
352+
uiState
353+
})
354+
: undefined}
345355
{@const tooltip = commitStatusLabel(commit.state.type)}
346-
<Dropzone handlers={[amendHandler, squashHandler, hunkHandler]}>
356+
<Dropzone handlers={[amendHandler, squashHandler, hunkHandler].filter(isDefined)}>
347357
{#snippet overlay({ hovered, activated, handler })}
348358
{@const label =
349359
handler instanceof AmendCommitWithChangeDzHandler ||
@@ -361,18 +371,20 @@
361371
date: getTimeAgo(commit.createdAt),
362372
authorImgUrl: undefined,
363373
commitType: commit.state.type,
364-
data: new CommitDropData(
365-
stackId,
366-
{
367-
id: commitId,
368-
isRemote: !!branchDetails.remoteTrackingBranch,
369-
hasConflicts: isLocalAndRemoteCommit(commit) && commit.hasConflicts,
370-
isIntegrated:
371-
isLocalAndRemoteCommit(commit) && commit.state.type === 'Integrated'
372-
},
373-
false,
374-
branchName
375-
),
374+
data: stackId
375+
? new CommitDropData(
376+
stackId,
377+
{
378+
id: commitId,
379+
isRemote: !!branchDetails.remoteTrackingBranch,
380+
hasConflicts: isLocalAndRemoteCommit(commit) && commit.hasConflicts,
381+
isIntegrated:
382+
isLocalAndRemoteCommit(commit) && commit.state.type === 'Integrated'
383+
},
384+
false,
385+
branchName
386+
)
387+
: undefined,
376388
viewportId: 'board-viewport',
377389
dropzoneRegistry,
378390
dragStateService

apps/desktop/src/components/BranchHeaderContextMenu.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
type Props = {
4141
projectId: string;
4242
stackId?: string;
43+
laneId: string;
4344
openId?: string;
4445
rightClickTrigger?: HTMLElement;
4546
contextData: BranchHeaderContextData;
@@ -48,6 +49,7 @@
4849
let {
4950
projectId,
5051
stackId,
52+
laneId,
5153
openId = $bindable(),
5254
rightClickTrigger,
5355
contextData
@@ -116,6 +118,7 @@
116118
await updateBranchNameMutation({
117119
projectId: projectId,
118120
stackId,
121+
laneId,
119122
branchName,
120123
newName: newBranchName
121124
});
@@ -259,6 +262,7 @@
259262
renameBranchModalContext = {
260263
projectId,
261264
stackId,
265+
laneId,
262266
branchName,
263267
isPushed: !!branch.remoteTrackingBranch
264268
};

0 commit comments

Comments
 (0)