mirror of
https://github.com/go-gitea/gitea
synced 2024-10-19 20:10:10 +02:00
update licenses info when update default branch
This commit is contained in:
parent
63a6da8867
commit
b9c2329e0e
@ -11,6 +11,7 @@ import (
|
||||
gitea_context "code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/private"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
)
|
||||
|
||||
// SetDefaultBranch updates the default branch
|
||||
@ -35,5 +36,13 @@ func SetDefaultBranch(ctx *gitea_context.PrivateContext) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
if err := repo_module.UpdateRepoLicenses(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo); err != nil {
|
||||
ctx.JSON(http.StatusInternalServerError, private.Response{
|
||||
Err: fmt.Sprintf("Unable to set default branch on repository: %s/%s Error: %v", ownerName, repoName, err),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
ctx.PlainText(http.StatusOK, "success")
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
@ -74,7 +75,11 @@ func SetDefaultBranchPost(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
if err := repo_model.UpdateDefaultBranch(repo); err != nil {
|
||||
ctx.ServerError("SetDefaultBranch", err)
|
||||
ctx.ServerError("UpdateDefaultBranch", err)
|
||||
return
|
||||
}
|
||||
if err := repo_module.UpdateRepoLicenses(ctx, repo, ctx.Repo.GitRepo); err != nil {
|
||||
ctx.ServerError("UpdateRepoLicenses", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user