1
0
Fork 0
forked from forgejo/forgejo

update go git from v4.10.0 to v4.11.0 (#7096)

This commit is contained in:
Lunny Xiao 2019-06-01 03:34:46 +08:00 committed by zeripath
parent fb4438a815
commit 8a343dda39
15 changed files with 93 additions and 40 deletions

View file

@ -320,11 +320,18 @@ func getFileStatsFromFilePatches(filePatches []fdiff.FilePatch) FileStats {
}
for _, chunk := range fp.Chunks() {
s := chunk.Content()
switch chunk.Type() {
case fdiff.Add:
cs.Addition += strings.Count(chunk.Content(), "\n")
cs.Addition += strings.Count(s, "\n")
if s[len(s)-1] != '\n' {
cs.Addition++
}
case fdiff.Delete:
cs.Deletion += strings.Count(chunk.Content(), "\n")
cs.Deletion += strings.Count(s, "\n")
if s[len(s)-1] != '\n' {
cs.Deletion++
}
}
}