MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / sanitizeUnifiedDiff

Function sanitizeUnifiedDiff

src/core/diff/stats.ts:16–19  ·  view source on GitHub ↗
(diff: string)

Source from the content-addressed store, hash-verified

14 * Remove non-semantic diff noise like "No newline at end of file"
15 */
16export function sanitizeUnifiedDiff(diff: string): string {
17 if (!diff) return diff
18 return diff.replace(/\r\n/g, "\n").replace(/(^|\n)[ \t]*(?:\\ )?No newline at end of file[ \t]*(?=\n|$)/gi, "$1")
19}
20
21/**
22 * Compute +/− counts from a unified diff (ignores headers/hunk lines)

Callers 7

executeMethod · 0.90
executeMethod · 0.90
executeMethod · 0.90
handleAddFileMethod · 0.90
handleUpdateFileMethod · 0.90
executeMethod · 0.90
executeMethod · 0.90

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected