MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / countTextDiffStats

Function countTextDiffStats

src/utils/git-diff-stats.ts:45–65  ·  view source on GitHub ↗
(
  original: string,
  modified: string,
)

Source from the content-addressed store, hash-verified

43}
44
45function countTextDiffStats(
46 original: string,
47 modified: string,
48): GitDiffLineStats {
49 const originalLines = original.length === 0 ? [] : original.split("\n");
50 const modifiedLines = modified.length === 0 ? [] : modified.split("\n");
51
52 if (originalLines.length === 0) {
53 return { additions: modifiedLines.length, deletions: 0 };
54 }
55
56 if (modifiedLines.length === 0) {
57 return { additions: 0, deletions: originalLines.length };
58 }
59
60 const unchanged = countUnchangedLines(originalLines, modifiedLines);
61 return {
62 additions: modifiedLines.length - unchanged,
63 deletions: originalLines.length - unchanged,
64 };
65}
66
67/**
68 * Work budget for the exact count in {@link countUnchangedLines}. Ordinary

Callers 1

countGitChangeDiffStatsFunction · 0.85

Calls 1

countUnchangedLinesFunction · 0.85

Tested by

no test coverage detected