fix: improve file tracking in MemberStatsComputer
- Updated the handling of bash lines to ensure unique file tracking by using a Set to eliminate duplicates. - Added logic to attribute per-file line changes only when a single file is touched, enhancing accuracy in line addition and removal reporting.
This commit is contained in:
parent
a9e0416251
commit
ca710b143b
1 changed files with 7 additions and 2 deletions
|
|
@ -271,9 +271,14 @@ export class MemberStatsComputer {
|
|||
const bashLines = estimateBashLinesChanged(cmd);
|
||||
linesAdded += bashLines.added;
|
||||
linesRemoved += bashLines.removed;
|
||||
for (const f of bashLines.files) {
|
||||
const touchedFiles = [...new Set(bashLines.files)];
|
||||
for (const f of touchedFiles) {
|
||||
trackFile(f);
|
||||
addFileLines(f, bashLines.added, bashLines.removed);
|
||||
}
|
||||
// Only attribute per-file lines when a single file is touched;
|
||||
// with multiple files we can't determine per-file distribution
|
||||
if (touchedFiles.length === 1) {
|
||||
addFileLines(touchedFiles[0], bashLines.added, bashLines.removed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue