diff options
author | Jason Song <i@wolfogre.com> | 2023-03-08 17:31:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-08 17:31:27 +0800 |
commit | 090e75392385041b3abb30d02564962a3ff687f6 (patch) | |
tree | bd21cf189765a8486d5b4fcb9c0aa68bda4eb46e /modules/label | |
parent | a12f5757372f751d25f9e5ca1f168f6920ded894 (diff) | |
download | gitea-090e75392385041b3abb30d02564962a3ff687f6.tar.gz gitea-090e75392385041b3abb30d02564962a3ff687f6.zip |
Reduce duplicate and useless code in options (#23369)
Avoid maintaining two copies of code, some functions can be used with
both `bindata` and `no bindata`.
And removed `GetRepoInitFile`, it's useless now.
`Readme`/`Gitignore`/`License`/`Labels` will clean the name and use
custom files when available.
Diffstat (limited to 'modules/label')
-rw-r--r-- | modules/label/parser.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/modules/label/parser.go b/modules/label/parser.go index 768c72a61b..55bf570de6 100644 --- a/modules/label/parser.go +++ b/modules/label/parser.go @@ -36,17 +36,17 @@ func (err ErrTemplateLoad) Error() string { // GetTemplateFile loads the label template file by given name, // then parses and returns a list of name-color pairs and optionally description. func GetTemplateFile(name string) ([]*Label, error) { - data, err := options.GetRepoInitFile("label", name+".yaml") + data, err := options.Labels(name + ".yaml") if err == nil && len(data) > 0 { return parseYamlFormat(name+".yaml", data) } - data, err = options.GetRepoInitFile("label", name+".yml") + data, err = options.Labels(name + ".yml") if err == nil && len(data) > 0 { return parseYamlFormat(name+".yml", data) } - data, err = options.GetRepoInitFile("label", name) + data, err = options.Labels(name) if err != nil { return nil, ErrTemplateLoad{name, fmt.Errorf("GetRepoInitFile: %w", err)} } |