Skip to content

Commit eb22290

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

2 files changed

Lines changed: 21 additions & 15 deletions

File tree

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -482,12 +482,23 @@ export const moveOperation = ({
482482

483483
if (branchMoveOperation) return branchMoveOperation;
484484

485-
const relativeTo: RelativeTo | null = Match.value(target).pipe(
485+
const relativeTo: RelativeTo | null = Match.value({ target, side }).pipe(
486486
Match.withReturnType<RelativeTo | null>(),
487-
Match.tags({
488-
Commit: ({ commitId }) => ({ type: "commit", subject: commitId }),
489-
Branch: ({ branchRef }) => ({ type: "referenceBytes", subject: branchRef }),
490-
}),
487+
Match.when({ target: { _tag: "Commit" } }, ({ target }) => ({
488+
type: "commit",
489+
subject: target.commitId,
490+
})),
491+
Match.when(
492+
{
493+
target: { _tag: "Branch" },
494+
// We use the branch operand as the source/target for the branch
495+
// contents. However, `RelativeTo` is interpreted to mean just the
496+
// branch reference rather than the whole branch (reference + contents),
497+
// meaning `side: "below"` won't work as expected.
498+
side: "above",
499+
},
500+
({ target }) => ({ type: "referenceBytes", subject: target.branchRef }),
501+
),
491502
Match.orElse(() => null),
492503
);
493504

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

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,18 +1488,13 @@ const BranchSegment: FC<{
14881488
aria-label={refName.displayName}
14891489
expanded
14901490
className={classes(workspaceItemRowStyles.section, styles.segment)}
1491+
render={<OperandC projectId={projectId} operand={operand} />}
14911492
>
1492-
<OperandC
1493+
<BranchRow
14931494
projectId={projectId}
1494-
operand={operand}
1495-
render={
1496-
<BranchRow
1497-
projectId={projectId}
1498-
branchName={refName.displayName}
1499-
branchRef={refName.fullNameBytes}
1500-
stackId={stackId}
1501-
/>
1502-
}
1495+
branchName={refName.displayName}
1496+
branchRef={refName.fullNameBytes}
1497+
stackId={stackId}
15031498
/>
15041499

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

0 commit comments

Comments
 (0)