mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-09 18:32:00 +02:00
Fix linguist-detectable attribute being ignored for configuration files (#36640)
Fixes: go-gitea/gitea#36637. `linguist-detectable` must be able to override the config classification. --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
258754f299
commit
8fdda2dd83
@ -108,7 +108,7 @@ func GetLanguageStats(repo *git_module.Repository, commitID string) (map[string]
|
|||||||
if (!isVendored.Has() && analyze.IsVendor(f.Name)) ||
|
if (!isVendored.Has() && analyze.IsVendor(f.Name)) ||
|
||||||
enry.IsDotFile(f.Name) ||
|
enry.IsDotFile(f.Name) ||
|
||||||
(!isDocumentation.Has() && enry.IsDocumentation(f.Name)) ||
|
(!isDocumentation.Has() && enry.IsDocumentation(f.Name)) ||
|
||||||
enry.IsConfiguration(f.Name) {
|
(!isDetectable.Has() && enry.IsConfiguration(f.Name)) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,7 @@ func GetLanguageStats(repo *git.Repository, commitID string) (map[string]int64,
|
|||||||
if (!isVendored.Has() && analyze.IsVendor(f.Name())) ||
|
if (!isVendored.Has() && analyze.IsVendor(f.Name())) ||
|
||||||
enry.IsDotFile(f.Name()) ||
|
enry.IsDotFile(f.Name()) ||
|
||||||
(!isDocumentation.Has() && enry.IsDocumentation(f.Name())) ||
|
(!isDocumentation.Has() && enry.IsDocumentation(f.Name())) ||
|
||||||
enry.IsConfiguration(f.Name()) {
|
(!isDetectable.Has() && enry.IsConfiguration(f.Name())) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -214,6 +214,17 @@ func TestLinguist(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ExpectedLanguageOrder: []string{"Markdown"},
|
ExpectedLanguageOrder: []string{"Markdown"},
|
||||||
},
|
},
|
||||||
|
// case 14: linguist-detectable on a configuration/data file (YAML) without linguist-language
|
||||||
|
{
|
||||||
|
GitAttributesContent: "*.yaml linguist-detectable",
|
||||||
|
FilesToAdd: []*files_service.ChangeRepoFile{
|
||||||
|
{
|
||||||
|
TreePath: "config.yaml",
|
||||||
|
ContentReader: strings.NewReader("name: test\ndescription: A test yaml file\n"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
ExpectedLanguageOrder: []string{"YAML"},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, c := range cases {
|
for i, c := range cases {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user