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

Function parseNumstatStats

projects/electron/src/modules/code/git.ts:969–996  ·  view source on GitHub ↗
(output: string)

Source from the content-addressed store, hash-verified

967}
968
969function parseNumstatStats(output: string): UncommittedChangesStats {
970 if (!output.trim()) {
971 return { filesChanged: 0, insertions: 0, deletions: 0 }
972 }
973
974 let filesChanged = 0
975 let insertions = 0
976 let deletions = 0
977
978 for (const line of output.split("\n")) {
979 if (!line.trim()) continue
980 const parts = line.split("\t")
981 if (parts.length < 3) continue
982
983 filesChanged++
984
985 const additions = parts[0]
986 const removals = parts[1]
987 if (additions !== "-") {
988 insertions += parseInt(additions, 10) || 0
989 }
990 if (removals !== "-") {
991 deletions += parseInt(removals, 10) || 0
992 }
993 }
994
995 return { filesChanged, insertions, deletions }
996}
997
998async function resolveWorkingDirFromGitStatusParams(params: GitStatusParams): Promise<string> {
999 validateRepoDir(params.repoDir)

Callers 1

collectGitSummaryDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected