MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / turnDiffToDiffData

Function turnDiffToDiffData

src/components/diff/DiffDialog.tsx:25–53  ·  view source on GitHub ↗
(turn: TurnDiff)

Source from the content-addressed store, hash-verified

23type DiffSource = { type: 'current' } | { type: 'turn'; turn: TurnDiff };
24
25function turnDiffToDiffData(turn: TurnDiff): DiffData {
26 const files = Array.from(turn.files.values())
27 .map(f => ({
28 path: f.filePath,
29 linesAdded: f.linesAdded,
30 linesRemoved: f.linesRemoved,
31 isBinary: false,
32 isLargeFile: false,
33 isTruncated: false,
34 isNewFile: f.isNewFile,
35 }))
36 .sort((a, b) => a.path.localeCompare(b.path));
37
38 const hunks = new Map<string, StructuredPatchHunk[]>();
39 for (const f of turn.files.values()) {
40 hunks.set(f.filePath, f.hunks);
41 }
42
43 return {
44 stats: {
45 filesCount: turn.stats.filesChanged,
46 linesAdded: turn.stats.linesAdded,
47 linesRemoved: turn.stats.linesRemoved,
48 },
49 files,
50 hunks,
51 loading: false,
52 };
53}
54
55export function DiffDialog({ messages, onDone }: Props): React.ReactNode {
56 const gitDiffData = useDiffData();

Callers 1

DiffDialogFunction · 0.85

Calls 1

setMethod · 0.80

Tested by

no test coverage detected