mirror of https://github.com/go-gitea/gitea.git
Merge pull request #272 from nuss-justin/dev
Add 'pprof' tag for enabling debugging
This commit is contained in:
commit
ae7f3eed78
|
@ -26,6 +26,7 @@ import (
|
||||||
"github.com/gogits/gogs/routers"
|
"github.com/gogits/gogs/routers"
|
||||||
"github.com/gogits/gogs/routers/admin"
|
"github.com/gogits/gogs/routers/admin"
|
||||||
"github.com/gogits/gogs/routers/api/v1"
|
"github.com/gogits/gogs/routers/api/v1"
|
||||||
|
"github.com/gogits/gogs/routers/debug"
|
||||||
"github.com/gogits/gogs/routers/dev"
|
"github.com/gogits/gogs/routers/dev"
|
||||||
"github.com/gogits/gogs/routers/org"
|
"github.com/gogits/gogs/routers/org"
|
||||||
"github.com/gogits/gogs/routers/repo"
|
"github.com/gogits/gogs/routers/repo"
|
||||||
|
@ -205,6 +206,8 @@ func runWeb(*cli.Context) {
|
||||||
r.Post("/:org/settings/delete", org.DeletePost)
|
r.Post("/:org/settings/delete", org.DeletePost)
|
||||||
}, reqSignIn)
|
}, reqSignIn)
|
||||||
|
|
||||||
|
debug.RegisterRoutes(m)
|
||||||
|
|
||||||
m.Group("/:username/:reponame", func(r martini.Router) {
|
m.Group("/:username/:reponame", func(r martini.Router) {
|
||||||
r.Get("/settings", repo.Setting)
|
r.Get("/settings", repo.Setting)
|
||||||
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
r.Post("/settings", bindIgnErr(auth.RepoSettingForm{}), repo.SettingPost)
|
||||||
|
|
|
@ -158,7 +158,7 @@ func IsRepositoryExist(u *User, repoName string) (bool, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
illegalEquals = []string{"raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new"}
|
illegalEquals = []string{"debug", "raw", "install", "api", "avatar", "user", "org", "help", "stars", "issues", "pulls", "commits", "repo", "template", "admin", "new"}
|
||||||
illegalSuffixs = []string{".git"}
|
illegalSuffixs = []string{".git"}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// +build pprof
|
||||||
|
|
||||||
|
package debug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http/pprof"
|
||||||
|
|
||||||
|
"github.com/go-martini/martini"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterRoutes(r martini.Router) {
|
||||||
|
r.Get("/debug/pprof/cmdline", pprof.Cmdline)
|
||||||
|
r.Get("/debug/pprof/profile", pprof.Profile)
|
||||||
|
r.Get("/debug/pprof/symbol", pprof.Symbol)
|
||||||
|
r.Get("/debug/pprof/**", pprof.Index)
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
// +build !pprof
|
||||||
|
|
||||||
|
package debug
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/go-martini/martini"
|
||||||
|
)
|
||||||
|
|
||||||
|
func RegisterRoutes(r martini.Router) {
|
||||||
|
// do nothing
|
||||||
|
}
|
Loading…
Reference in New Issue