@@ -23,7 +23,7 @@ export const ReviewToolkitHandlersLive = ReviewToolkit.toLayer({
2323 const review = yield * Review . ReviewService ;
2424 // A file request reads a single source; branch-range covers committed and uncommitted work.
2525 const sourceKind = input . source ?? ( input . file === undefined ? undefined : "branch-range" ) ;
26- const readPreview = ( file ?: ReviewDiffPreviewInput [ "file" ] , baseRef = input . baseRef ) =>
26+ const readPreview = ( baseRef : string | undefined , file ?: ReviewDiffPreviewInput [ "file" ] ) =>
2727 review
2828 . getDiffPreview ( {
2929 cwd : thread . worktreePath ?? project . value . workspaceRoot ,
@@ -50,18 +50,15 @@ export const ReviewToolkitHandlersLive = ReviewToolkit.toLayer({
5050 if ( input . file !== undefined && sourceKind !== undefined ) {
5151 // A renamed file needs its old path, which only the full preview's stats know. The lookup
5252 // is best effort: a working-tree read must not fail on a branch range it does not need.
53- const full = yield * readPreview ( ) . pipe ( Effect . orElseSucceed ( ( ) => undefined ) ) ;
53+ const full = yield * readPreview ( input . baseRef ) . pipe ( Effect . orElseSucceed ( ( ) => undefined ) ) ;
5454 const previousPath =
5555 full ?. sources
5656 . find ( ( source ) => source . kind === sourceKind )
5757 ?. files ?. find ( ( file ) => file . path === input . file ) ?. previousPath ?? null ;
58- preview = yield * readPreview ( { path : input . file , previousPath, sourceKind } ) ;
58+ preview = yield * readPreview ( input . baseRef , { path : input . file , previousPath, sourceKind } ) ;
5959 } else {
6060 // The working tree needs no base, so a baseRef the branch range can't use is not passed.
61- preview = yield * readPreview (
62- undefined ,
63- sourceKind === "working-tree" ? undefined : input . baseRef ,
64- ) ;
61+ preview = yield * readPreview ( sourceKind === "working-tree" ? undefined : input . baseRef ) ;
6562 }
6663 if ( preview . sources . length === 0 )
6764 return yield * invalid ( "The thread's checkout is not a git repository." ) ;
0 commit comments