Skip to content

Commit 6329862

Browse files
committed
Use branch operand as source/target for whole branch rather than just branch reference
1 parent ab1469a commit 6329862

2 files changed

Lines changed: 21 additions & 18 deletions

File tree

apps/lite/ui/src/operations/operation.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,22 @@ export const moveOperation = ({
477477

478478
if (branchMoveOperation) return branchMoveOperation;
479479

480-
const relativeTo: RelativeTo | null = Match.value(target).pipe(
481-
Match.tags({
482-
Commit: ({ commitId }): RelativeTo | null => ({ type: "commit", subject: commitId }),
483-
Branch: ({ branchRef }): RelativeTo | null => ({
484-
type: "referenceBytes",
485-
subject: branchRef,
486-
}),
487-
}),
480+
const relativeTo: RelativeTo | null = Match.value({ target, side }).pipe(
481+
Match.when({ target: { _tag: "Commit" } }, ({ target }): RelativeTo | null => ({
482+
type: "commit",
483+
subject: target.commitId,
484+
})),
485+
Match.when(
486+
{
487+
target: { _tag: "Branch" },
488+
// We use the branch operand as the source/target for the branch
489+
// contents. However, `RelativeTo` is interpreted to mean just the
490+
// branch reference rather than the whole branch (reference + contents),
491+
// meaning `side: "below"` won't work as expected.
492+
side: "above",
493+
},
494+
({ target }): RelativeTo | null => ({ type: "referenceBytes", subject: target.branchRef }),
495+
),
488496
Match.orElse((): RelativeTo | null => null),
489497
);
490498

apps/lite/ui/src/routes/project/$id/workspace/OutlinePanel.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,18 +1498,13 @@ const BranchSegment: FC<{
14981498
aria-label={refName.displayName}
14991499
expanded
15001500
className={classes(workspaceItemRowStyles.section, styles.segment)}
1501+
render={<OperandC projectId={projectId} operand={operand} />}
15011502
>
1502-
<OperandC
1503+
<BranchRow
15031504
projectId={projectId}
1504-
operand={operand}
1505-
render={
1506-
<BranchRow
1507-
projectId={projectId}
1508-
branchName={refName.displayName}
1509-
branchRef={refName.fullNameBytes}
1510-
stackId={stackId}
1511-
/>
1512-
}
1505+
branchName={refName.displayName}
1506+
branchRef={refName.fullNameBytes}
1507+
stackId={stackId}
15131508
/>
15141509

15151510
{segment.commits.length === 0 ? (

0 commit comments

Comments
 (0)