diff options
author | Andrey Nering <andrey.nering@gmail.com> | 2016-11-05 13:58:53 -0200 |
---|---|---|
committer | Andrey Nering <andrey.nering@gmail.com> | 2016-11-05 15:44:14 -0200 |
commit | bd898a10f888005be990ebea2e6a845d09ef55f3 (patch) | |
tree | 784e84c939367a64b5bd5a7322a801dd83108642 /routers | |
parent | 91b589f2f0fb93f9f9882426c43c363276d2235a (diff) | |
download | gitea-bd898a10f888005be990ebea2e6a845d09ef55f3.tar.gz gitea-bd898a10f888005be990ebea2e6a845d09ef55f3.zip |
Refactor editorconfig middleware
Diffstat (limited to 'routers')
-rw-r--r-- | routers/repo/commit.go | 5 | ||||
-rw-r--r-- | routers/repo/middlewares.go | 2 | ||||
-rw-r--r-- | routers/repo/pull.go | 10 | ||||
-rw-r--r-- | routers/repo/view.go | 5 |
4 files changed, 1 insertions, 21 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index 4a4d4b1231..041247939c 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -179,11 +179,6 @@ func Diff(ctx *context.Context) { } } - setEditorconfigIfExists(ctx) - if ctx.Written() { - return - } - ctx.Data["CommitID"] = commitID ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split" ctx.Data["Username"] = userName diff --git a/routers/repo/middlewares.go b/routers/repo/middlewares.go index f025765cb9..7e1f95d417 100644 --- a/routers/repo/middlewares.go +++ b/routers/repo/middlewares.go @@ -8,7 +8,7 @@ import ( "github.com/gogits/git-module" ) -func setEditorconfigIfExists(ctx *context.Context) { +func SetEditorconfigIfExists(ctx *context.Context) { ec, err := ctx.Repo.GetEditorconfig() if err != nil && !git.IsErrNotExist(err) { diff --git a/routers/repo/pull.go b/routers/repo/pull.go index 6dbb2b6025..62162af67b 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -368,11 +368,6 @@ func ViewPullFiles(ctx *context.Context) { return } - setEditorconfigIfExists(ctx) - if ctx.Written() { - return - } - headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name) ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split" ctx.Data["Username"] = pull.HeadUserName @@ -625,11 +620,6 @@ func CompareAndPullRequest(ctx *context.Context) { } } - setEditorconfigIfExists(ctx) - if ctx.Written() { - return - } - ctx.HTML(200, COMPARE_PULL) } diff --git a/routers/repo/view.go b/routers/repo/view.go index ee49d4da15..e8b8d1e002 100644 --- a/routers/repo/view.go +++ b/routers/repo/view.go @@ -245,11 +245,6 @@ func Home(ctx *context.Context) { return } - setEditorconfigIfExists(ctx) - if ctx.Written() { - return - } - var treeNames []string paths := make([]string, 0, 5) if len(ctx.Repo.TreePath) > 0 { |