mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
On open repository open common cat file batch and batch-check (#15667)
Use common git cat-file --batch and git cat-file --batch-check to significantly reduce calls to git. Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
@@ -905,12 +905,18 @@ func (ctx *Context) IssueTemplatesFromDefaultBranch() []api.IssueTemplate {
|
||||
log.Debug("DataAsync: %v", err)
|
||||
continue
|
||||
}
|
||||
defer r.Close()
|
||||
closed := false
|
||||
defer func() {
|
||||
if !closed {
|
||||
_ = r.Close()
|
||||
}
|
||||
}()
|
||||
data, err := ioutil.ReadAll(r)
|
||||
if err != nil {
|
||||
log.Debug("ReadAll: %v", err)
|
||||
continue
|
||||
}
|
||||
_ = r.Close()
|
||||
var it api.IssueTemplate
|
||||
content, err := markdown.ExtractMetadata(string(data), &it)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user