You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
533 B

  1. package repo
  2. import (
  3. "fmt"
  4. "github.com/go-gitea/gitea/models"
  5. "github.com/go-gitea/gitea/modules/context"
  6. "github.com/go-gitea/git"
  7. )
  8. func SetEditorconfigIfExists(ctx *context.Context) {
  9. ec, err := ctx.Repo.GetEditorconfig()
  10. if err != nil && !git.IsErrNotExist(err) {
  11. description := fmt.Sprintf("Error while getting .editorconfig file: %v", err)
  12. if err := models.CreateRepositoryNotice(description); err != nil {
  13. ctx.Handle(500, "ErrCreatingReporitoryNotice", err)
  14. }
  15. return
  16. }
  17. ctx.Data["Editorconfig"] = ec
  18. }