From 2527037973441054692ee11446196d3ac6b135c3 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 1 Feb 2017 07:24:20 -0500 Subject: [PATCH] routers/repo: minor code fix for PR #3758 --- gogs.go | 2 +- routers/repo/middlewares.go | 23 ----------------------- routers/repo/view.go | 9 +++++++++ templates/.VERSION | 2 +- 4 files changed, 11 insertions(+), 25 deletions(-) delete mode 100644 routers/repo/middlewares.go diff --git a/gogs.go b/gogs.go index 16482ab51..1f4f93594 100644 --- a/gogs.go +++ b/gogs.go @@ -16,7 +16,7 @@ import ( "github.com/gogits/gogs/modules/setting" ) -const APP_VER = "0.9.130.0131" +const APP_VER = "0.9.131.0201" func init() { setting.AppVer = APP_VER diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go deleted file mode 100644 index 2c3444200..000000000 --- a/routers/repo/middlewares.go +++ /dev/null @@ -1,23 +0,0 @@ -package repo - -import ( - "fmt" - - "github.com/gogits/git-module" - "github.com/gogits/gogs/models" - "github.com/gogits/gogs/modules/context" -) - -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 -} diff --git a/routers/repo/view.go b/routers/repo/view.go index 7d9278e7b..18c79e085 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -211,6 +211,15 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st } } +func setEditorconfigIfExists(ctx *context.Context) { + ec, err := ctx.Repo.GetEditorconfig() + if err != nil && !git.IsErrNotExist(err) { + log.Error(4, "Fail to get '.editorconfig' [%d]: %v", ctx.Repo.Repository.ID, err) + return + } + ctx.Data["Editorconfig"] = ec +} + func Home(ctx *context.Context) { title := ctx.Repo.Repository.Owner.Name + "/" + ctx.Repo.Repository.Name if len(ctx.Repo.Repository.Description) > 0 { diff --git a/templates/.VERSION b/templates/.VERSION index 4be34e6de..19f82a0d5 100644 --- a/templates/.VERSION +++ b/templates/.VERSION @@ -1 +1 @@ -0.9.130.0131 \ No newline at end of file +0.9.131.0201 \ No newline at end of file