1
0
Fork 0
forked from forgejo/forgejo

Merge different languages for language stats (#24900) (#24921)

Backport #24900

Fix #24896

If users set different languages by `linguist-language`, the `stats` map
could be: `java: 100, Java: 200`.

Language stats are stored as case-insensitive in database and there is a
unique key.

So, the different language names should be merged to one unique name:
`Java: 300`

(cherry picked from commit a83d597989)
This commit is contained in:
wxiaoguang 2023-05-25 13:12:21 +08:00 committed by Earl Warren
parent 5fdac0d46a
commit 6d3b3af57d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
4 changed files with 58 additions and 5 deletions

View file

@ -156,7 +156,7 @@ func (repo *Repository) GetLanguageStats(commitID string) (map[string]int64, err
sizes[firstExcludedLanguage] = firstExcludedLanguageSize
}
return sizes, nil
return mergeLanguageStats(sizes), nil
}
func readFile(f *object.File, limit int64) ([]byte, error) {