aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/web.go13
-rw-r--r--routers/repo/commit.go5
-rw-r--r--routers/repo/middlewares.go2
-rw-r--r--routers/repo/pull.go10
-rw-r--r--routers/repo/view.go5
5 files changed, 8 insertions, 27 deletions
diff --git a/cmd/web.go b/cmd/web.go
index a43dae38f3..d80c2096c5 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -520,7 +520,8 @@ func runWeb(ctx *cli.Context) error {
ctx.Data["CommitsCount"] = ctx.Repo.CommitsCount
})
- m.Combo("/compare/*", repo.MustAllowPulls).Get(repo.CompareAndPullRequest).
+ m.Combo("/compare/*", repo.MustAllowPulls, repo.SetEditorconfigIfExists).
+ Get(repo.CompareAndPullRequest).
Post(bindIgnErr(auth.CreateIssueForm{}), repo.CompareAndPullRequestPost)
m.Group("", func() {
@@ -579,15 +580,15 @@ func runWeb(ctx *cli.Context) error {
m.Group("/pulls/:index", func() {
m.Get("/commits", context.RepoRef(), repo.ViewPullCommits)
- m.Get("/files", context.RepoRef(), repo.ViewPullFiles)
+ m.Get("/files", context.RepoRef(), repo.SetEditorconfigIfExists, repo.ViewPullFiles)
m.Post("/merge", reqRepoWriter, repo.MergePullRequest)
}, repo.MustAllowPulls)
m.Group("", func() {
- m.Get("/src/*", repo.Home)
+ m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
m.Get("/raw/*", repo.SingleDownload)
m.Get("/commits/*", repo.RefCommits)
- m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.Diff)
+ m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.SetEditorconfigIfExists, repo.Diff)
m.Get("/forks", repo.Forks)
}, context.RepoRef())
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.RawDiff)
@@ -601,8 +602,8 @@ func runWeb(ctx *cli.Context) error {
m.Group("/:username", func() {
m.Group("/:reponame", func() {
- m.Get("", repo.Home)
- m.Get("\\.git$", repo.Home)
+ m.Get("", repo.SetEditorconfigIfExists, repo.Home)
+ m.Get("\\.git$", repo.SetEditorconfigIfExists, repo.Home)
}, ignSignIn, context.RepoAssignment(true), context.RepoRef())
m.Group("/:reponame", func() {
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 {