MCPcopy Create free account
hub / github.com/gogs/gogs / DeleteRepo

Function DeleteRepo

internal/route/admin/repos.go:66–83  ·  view source on GitHub ↗
(c *context.Context)

Source from the content-addressed store, hash-verified

64}
65
66func DeleteRepo(c *context.Context) {
67 repo, err := database.GetRepositoryByID(c.QueryInt64("id"))
68 if err != nil {
69 c.Error(err, "get repository by ID")
70 return
71 }
72
73 if err := database.DeleteRepository(repo.MustOwner().ID, repo.ID); err != nil {
74 c.Error(err, "delete repository")
75 return
76 }
77 log.Trace("Repository deleted: %s/%s", repo.MustOwner().Name, repo.Name)
78
79 c.Flash.Success(c.Tr("repo.settings.deletion_success"))
80 c.JSONSuccess(map[string]any{
81 "redirect": conf.Server.Subpath + "/admin/repos?page=" + c.Query("page"),
82 })
83}

Callers

nothing calls this directly

Calls 7

GetRepositoryByIDFunction · 0.92
DeleteRepositoryFunction · 0.92
MustOwnerMethod · 0.80
SuccessMethod · 0.80
TrMethod · 0.80
JSONSuccessMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected