You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
741 B

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  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. "code.gitea.io/gitea/modules/base"
  7. "code.gitea.io/gitea/modules/context"
  8. )
  9. const (
  10. tplBranch base.TplName = "repo/branch"
  11. )
  12. // Branches render repository branch page
  13. func Branches(ctx *context.Context) {
  14. ctx.Data["Title"] = "Branches"
  15. ctx.Data["IsRepoToolbarBranches"] = true
  16. brs, err := ctx.Repo.GitRepo.GetBranches()
  17. if err != nil {
  18. ctx.Handle(500, "repo.Branches(GetBranches)", err)
  19. return
  20. } else if len(brs) == 0 {
  21. ctx.Handle(404, "repo.Branches(GetBranches)", nil)
  22. return
  23. }
  24. ctx.Data["Branches"] = brs
  25. ctx.HTML(200, tplBranch)
  26. }