Fix bare-repo bugs (#2199)

* Fix bare-repo bugs

* Integration tests

* Unused import
This commit is contained in:
Ethan Koenig 2017-07-27 02:23:38 -07:00 committed by Lauris BH
parent aff11bc65e
commit fd45a032a7
23 changed files with 575 additions and 2 deletions

View file

@ -590,11 +590,14 @@ func RegisterRoutes(m *macaron.Macaron) {
}, repo.MustAllowPulls, context.CheckUnit(models.UnitTypePullRequests))
m.Group("", func() {
m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
m.Get("/raw/*", repo.SingleDownload)
m.Get("/commits/*", repo.RefCommits)
m.Get("/graph", repo.Graph)
m.Get("/commit/:sha([a-f0-9]{7,40})$", repo.SetEditorconfigIfExists, repo.SetDiffViewStyle, repo.Diff)
}, repo.MustBeNotBare, context.RepoRef(), context.CheckUnit(models.UnitTypeCode))
m.Group("", func() {
m.Get("/src/*", repo.SetEditorconfigIfExists, repo.Home)
m.Get("/forks", repo.Forks)
}, context.RepoRef(), context.CheckUnit(models.UnitTypeCode))
m.Get("/commit/:sha([a-f0-9]{7,40})\\.:ext(patch|diff)", repo.MustBeNotBare, repo.RawDiff, context.CheckUnit(models.UnitTypeCode))