Add repo branches endpoint (#481)

* add repo branches endpoint

* add branches func to remotes
This commit is contained in:
Anbraten
2021-10-27 02:47:55 +02:00
committed by GitHub
parent 63a93087a1
commit d35f5158bc
11 changed files with 125 additions and 0 deletions

View File

@@ -170,6 +170,20 @@ func GetRepoPermissions(c *gin.Context) {
c.JSON(http.StatusOK, perm)
}
func GetRepoBranches(c *gin.Context) {
repo := session.Repo(c)
user := session.User(c)
r := remote.FromContext(c)
branches, err := r.Branches(c, user, repo)
if err != nil {
c.AbortWithError(http.StatusInternalServerError, err)
return
}
c.JSON(http.StatusOK, branches)
}
func DeleteRepo(c *gin.Context) {
remove, _ := strconv.ParseBool(c.Query("remove"))
r := remote.FromContext(c)