Skip to content

Commit ad9fe8f

Browse files
committed
feat(cli): warn when structural diffing is enabled for patch-backed loaders
1 parent 8c82968 commit ad9fe8f

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

src/core/cli.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,18 @@ async function parseShowCommand(tokens: string[], argv: string[]): Promise<Parse
464464

465465
await parseStandaloneCommand(command, commandTokens);
466466

467+
const options = buildCommonOptions(parsedOptions, argv);
468+
if (options.structural) {
469+
console.warn(
470+
"Warning: --structural is ignored for `show` because AST diffing requires full file trees.",
471+
);
472+
}
473+
467474
return {
468475
kind: "show",
469476
ref: parsedRef,
470477
pathspecs: pathspecs.length > 0 ? pathspecs : undefined,
471-
options: buildCommonOptions(parsedOptions, argv),
478+
options,
472479
};
473480
}
474481

@@ -492,10 +499,17 @@ async function parsePatchCommand(tokens: string[], argv: string[]): Promise<Pars
492499

493500
await parseStandaloneCommand(command, tokens);
494501

502+
const options = buildCommonOptions(parsedOptions, argv);
503+
if (options.structural) {
504+
console.warn(
505+
"Warning: --structural is ignored for `patch` because AST diffing requires full file trees.",
506+
);
507+
}
508+
495509
return {
496510
kind: "patch",
497511
file: parsedFile,
498-
options: buildCommonOptions(parsedOptions, argv),
512+
options,
499513
};
500514
}
501515

@@ -1277,10 +1291,17 @@ async function parseStashCommand(tokens: string[], argv: string[]): Promise<Pars
12771291

12781292
await parseStandaloneCommand(command, rest);
12791293

1294+
const options = buildCommonOptions(parsedOptions, argv);
1295+
if (options.structural) {
1296+
console.warn(
1297+
"Warning: --structural is ignored for `stash show` because AST diffing requires full file trees.",
1298+
);
1299+
}
1300+
12801301
return {
12811302
kind: "stash-show",
12821303
ref: parsedRef,
1283-
options: buildCommonOptions(parsedOptions, argv),
1304+
options,
12841305
};
12851306
}
12861307

src/ui/diff/renderRows.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from "./codeColumns";
99
import type { DiffRow, RenderSpan, SplitLineCell, StackLineCell } from "./pierre";
1010
import { blendHex } from "../lib/color";
11-
import type { StructuralChange } from "../../core/types";
1211

1312
/** Clamp a label to one terminal row with an ellipsis. */
1413
export function fitText(text: string, width: number) {
@@ -716,7 +715,7 @@ function renderRow(
716715
annotated: boolean,
717716
anchorId?: string,
718717
noteGuideSide?: "old" | "new",
719-
structuralChange?: StructuralChange,
718+
structuralChange?: boolean,
720719
onOpenAgentNotesAtHunk?: (hunkIndex: number) => void,
721720
) {
722721
let baseRow: ReactNode;
@@ -957,7 +956,7 @@ interface DiffRowViewProps {
957956
annotated: boolean;
958957
anchorId?: string;
959958
noteGuideSide?: "old" | "new";
960-
structuralChange?: StructuralChange;
959+
structuralChange?: boolean;
961960
onOpenAgentNotesAtHunk?: (hunkIndex: number) => void;
962961
}
963962

0 commit comments

Comments
 (0)