branch.go 658 B

12345678910111213141516171819202122232425262728
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package repo
  5. import (
  6. "github.com/go-martini/martini"
  7. "github.com/gogits/gogs/modules/middleware"
  8. )
  9. func Branches(ctx *middleware.Context, params martini.Params) {
  10. ctx.Data["Title"] = "Branches"
  11. ctx.Data["IsRepoToolbarBranches"] = true
  12. brs, err := ctx.Repo.GitRepo.GetBranches()
  13. if err != nil {
  14. ctx.Handle(500, "repo.Branches", err)
  15. return
  16. } else if len(brs) == 0 {
  17. ctx.Handle(404, "repo.Branches", nil)
  18. return
  19. }
  20. ctx.Data["Branches"] = brs
  21. ctx.HTML(200, "repo/branches")
  22. }