MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / parseNumstatOutput

Function parseNumstatOutput

projects/electron/src/modules/code/git.ts:940–959  ·  view source on GitHub ↗

* Parse git diff --numstat output to get file info with binary detection * Format: "10\t5\tfile.ts" for text files, "-\t-\tfile.png" for binary files

(output: string)

Source from the content-addressed store, hash-verified

938 * Format: "10\t5\tfile.ts" for text files, "-\t-\tfile.png" for binary files
939 */
940function parseNumstatOutput(output: string): GitFileInfo[] {
941 if (!output.trim()) return []
942
943 return output
944 .split("\n")
945 .filter((line) => line.trim())
946 .map((line) => {
947 // Format: additions<tab>deletions<tab>filepath
948 // Binary files show as: -<tab>-<tab>filepath
949 const parts = line.split("\t")
950 if (parts.length < 3) return null
951
952 const [additions, , ...pathParts] = parts
953 const filePath = pathParts.join("\t") // Handle paths with tabs (rare but possible)
954 const binary = additions === "-"
955
956 return { path: filePath, binary }
957 })
958 .filter((f): f is GitFileInfo => f !== null)
959}
960
961/** Merge status codes from --name-status into GitFileInfo[] from --numstat */
962function mergeFileStatuses(files: GitFileInfo[], statuses: ChangedFileInfo[]): void {

Callers 1

collectGitSummaryDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected