branch.go 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/gogits/git-module"
  7. "github.com/gogits/gogs/modules/base"
  8. "github.com/gogits/gogs/modules/context"
  9. "github.com/gogits/gogs/modules/log"
  10. )
  11. const (
  12. BRANCH base.TplName = "repo/branch"
  13. )
  14. func Branches(ctx *context.Context) {
  15. ctx.Data["Title"] = "Branches"
  16. ctx.Data["IsRepoToolbarBranches"] = true
  17. brs, err := ctx.Repo.GitRepo.GetBranches()
  18. if err != nil {
  19. ctx.Handle(500, "repo.Branches(GetBranches)", err)
  20. return
  21. } else if len(brs) == 0 {
  22. ctx.Handle(404, "repo.Branches(GetBranches)", nil)
  23. return
  24. }
  25. ctx.Data["Branches"] = brs
  26. ctx.HTML(200, BRANCH)
  27. }
  28. func DeleteBranchPost(ctx *context.Context) {
  29. branchName := ctx.Params(":name")
  30. commitID := ctx.Query("commit")
  31. defer func() {
  32. redirectTo := ctx.Query("redirect_to")
  33. if len(redirectTo) == 0 {
  34. redirectTo = ctx.Repo.RepoLink
  35. }
  36. ctx.Redirect(redirectTo)
  37. }()
  38. if !ctx.Repo.GitRepo.IsBranchExist(branchName) {
  39. return
  40. }
  41. if len(commitID) > 0 {
  42. branchCommitID, err := ctx.Repo.GitRepo.GetBranchCommitID(branchName)
  43. if err != nil {
  44. log.Error(4, "GetBranchCommitID: %v", err)
  45. return
  46. }
  47. if branchCommitID != commitID {
  48. ctx.Flash.Error(ctx.Tr("repo.pulls.delete_branch_has_new_commits"))
  49. return
  50. }
  51. }
  52. if err := ctx.Repo.GitRepo.DeleteBranch(branchName, git.DeleteBranchOptions{
  53. Force: false,
  54. }); err != nil {
  55. log.Error(4, "DeleteBranch: %v", err)
  56. return
  57. }
  58. }
PANIC: session(release): write data/sessions/6/c/6c607ef03cfe9c05: no space left on device

PANIC

session(release): write data/sessions/6/c/6c607ef03cfe9c05: no space left on device
github.com/go-macaron/session@v0.0.0-20190805070824-1a3cdc6f5659/session.go:199 (0x8b2934)
gopkg.in/macaron.v1@v1.3.9/context.go:79 (0x83d0a0)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/context.go:112 (0x84fdb5)
gopkg.in/macaron.v1@v1.3.9/recovery.go:161 (0x84fda8)
gopkg.in/macaron.v1@v1.3.9/logger.go:40 (0x840c73)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:157 (0x80ab07)
github.com/go-macaron/inject@v0.0.0-20160627170012-d8a0b8677191/inject.go:135 (0x80a8a8)
gopkg.in/macaron.v1@v1.3.9/context.go:121 (0x83d1f8)
gopkg.in/macaron.v1@v1.3.9/router.go:187 (0x850fc6)
gopkg.in/macaron.v1@v1.3.9/router.go:303 (0x8493e5)
gopkg.in/macaron.v1@v1.3.9/macaron.go:220 (0x841fca)
net/http/server.go:2836 (0x7a79b2)
net/http/server.go:1924 (0x7a341b)
runtime/asm_amd64.s:1373 (0x46f9f0)