mirror of
https://github.com/go-gitea/gitea
synced 2024-10-19 20:10:10 +02:00
fix changes from 28691
This commit is contained in:
parent
91c54540e5
commit
5e72897db8
@ -9,7 +9,6 @@ import (
|
||||
git_model "code.gitea.io/gitea/models/git"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
repo_module "code.gitea.io/gitea/modules/repository"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/routers/web/repo"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
@ -35,7 +34,7 @@ func SetDefaultBranchPost(ctx *context.Context) {
|
||||
}
|
||||
|
||||
branch := ctx.FormString("branch")
|
||||
if err := repo_service.SetRepoDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, branch); err != nil {
|
||||
if err := repo_service.SetRepoDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo, ctx.Repo.Commit, branch); err != nil {
|
||||
switch {
|
||||
case git_model.IsErrBranchNotExist(err):
|
||||
ctx.Status(http.StatusNotFound)
|
||||
|
@ -468,7 +468,7 @@ func AddAllRepoBranchesToSyncQueue(ctx context.Context, doerID int64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, newBranchName string) error {
|
||||
func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, commit *git.Commit, newBranchName string) error {
|
||||
if repo.DefaultBranch == newBranchName {
|
||||
return nil
|
||||
}
|
||||
@ -505,6 +505,9 @@ func SetRepoDefaultBranch(ctx context.Context, repo *repo_model.Repository, gitR
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := repo_module.UpdateRepoLicenses(ctx, repo, commit); err != nil {
|
||||
log.Error("UpdateRepoLicenses: %v", err)
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return err
|
||||
|
Loading…
Reference in New Issue
Block a user