MCPcopy Create free account
hub / github.com/agent-tower/core / parseNameStatus

Function parseNameStatus

packages/server/src/routes/git.ts:92–108  ·  view source on GitHub ↗
(output: string)

Source from the content-addressed store, hash-verified

90
91function parseNameStatus(output: string): ChangeEntry[] {
92 if (!output.trim()) return [];
93 return output
94 .trim()
95 .split('\n')
96 .map((line) => {
97 // Format: "M\tpath" or "R100\told\tnew"
98 const parts = line.split('\t');
99 if (parts.length < 2) return null;
100 const rawStatus = parts[0]!;
101 // Normalize rename status (R100 -> R)
102 const status = rawStatus.startsWith('R') ? 'R' : rawStatus;
103 const filePath = parts.length >= 3 ? parts[2]! : parts[1]!;
104 return { status, path: filePath };
105 })
106 .filter((entry): entry is ChangeEntry => entry !== null);
107}
108
109/** Parse `git diff --numstat` output into a path → {additions, deletions} map. */
110function parseNumstat(output: string): Map<string, { additions: number; deletions: number }> {
111 const map = new Map<string, { additions: number; deletions: number }>();

Callers 1

gitRoutesFunction · 0.85

Calls 1

trimMethod · 0.80

Tested by

no test coverage detected