This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Chunk stats calculation has wrong line count for additions and deletions #1074
Closed
Description
Current code in patch.go
has:
for _, chunk := range fp.Chunks() {
switch chunk.Type() {
case fdiff.Add:
cs.Addition += strings.Count(chunk.Content(), "\n")
case fdiff.Delete:
cs.Deletion += strings.Count(chunk.Content(), "\n")
}
}
That will have wrong count as if chunk content is line1\nline2
that is 2 additions/deletions not one.
Looks like this calculation is wrong only if there is no newline at the end of file
Metadata
Metadata
Assignees
Labels
No labels