Correctly support linguist-documentation=false
If a documentation file is marked with a `linguist-documentation=false` attribute, include it in language stats. However, make sure that we do *not* include documentation languages as fallback. Added a new test case to exercise the formerly buggy behaviour. Problem discovered while reviewing @KN4CK3R's tests from gitea#29267. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
ee39c58120
commit
ae0635fd61
4 changed files with 29 additions and 23 deletions
|
@ -251,5 +251,18 @@ func TestLinguistSupport(t *testing.T) {
|
|||
assertFileLanguage(t, "/blame/branch/main/foo.c", "Bash")
|
||||
})
|
||||
})
|
||||
|
||||
// 10. Marking a file as non-documentation
|
||||
t.Run("linguist-documentation=false", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
repo, sha, f := prep(t, "README.md linguist-documentation=false\n")
|
||||
defer f()
|
||||
|
||||
langs := getFreshLanguageStats(t, repo, sha)
|
||||
assert.Len(t, langs, 2)
|
||||
assert.Equal(t, "Markdown", langs[0].Language)
|
||||
assert.Equal(t, "C", langs[1].Language)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue