Skip to content

Commit 9700aea

Browse files
committed
Use branch operand as source/target for whole branch rather than just branch reference
1 parent 9da0c0b commit 9700aea

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
@@ -482,14 +482,22 @@ export const moveOperation = ({
482482

483483
if (branchMoveOperation) return branchMoveOperation;
484484

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

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)