}
}
- ec, err := ctx.Repo.GetEditorconfig()
- if err != nil && !git.IsErrNotExist(err) {
- ctx.Handle(500, "ErrGettingEditorconfig", err)
+ setEditorconfigIfExists(ctx)
+ if ctx.Written() {
return
}
- ctx.Data["Editorconfig"] = ec
ctx.Data["CommitID"] = commitID
ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split"
--- /dev/null
+package repo
+
+import (
+ "fmt"
+
+ "github.com/go-gitea/gitea/models"
+ "github.com/go-gitea/gitea/modules/context"
+ "github.com/gogits/git-module"
+)
+
+func setEditorconfigIfExists(ctx *context.Context) {
+ ec, err := ctx.Repo.GetEditorconfig()
+
+ if err != nil && !git.IsErrNotExist(err) {
+ description := fmt.Sprintf("Error while getting .editorconfig file: %v", err)
+ if err := models.CreateRepositoryNotice(description); err != nil {
+ ctx.Handle(500, "ErrCreatingReporitoryNotice", err)
+ }
+ return
+ }
+
+ ctx.Data["Editorconfig"] = ec
+}
return
}
- ec, err := ctx.Repo.GetEditorconfig()
- if err != nil && !git.IsErrNotExist(err) {
- ctx.Handle(500, "ErrGettingEditorconfig", err)
+ setEditorconfigIfExists(ctx)
+ if ctx.Written() {
return
}
- ctx.Data["Editorconfig"] = ec
headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name)
ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split"
}
}
- ec, err := ctx.Repo.GetEditorconfig()
- if err != nil && !git.IsErrNotExist(err) {
- ctx.Handle(500, "ErrGettingEditorconfig", err)
+ setEditorconfigIfExists(ctx)
+ if ctx.Written() {
return
}
- ctx.Data["Editorconfig"] = ec
ctx.HTML(200, COMPARE_PULL)
}
return
}
- ec, err := ctx.Repo.GetEditorconfig()
- if err != nil && !git.IsErrNotExist(err) {
- ctx.Handle(500, "Repo.GetEditorconfig", err)
+ setEditorconfigIfExists(ctx)
+ if ctx.Written() {
return
}
- ctx.Data["Editorconfig"] = ec
var treeNames []string
paths := make([]string, 0, 5)