mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-19 08:20:13 +00:00
[PORT] Fix git error handling (gitea#32401)
--- Conflict resolution: Trivial, for `repo_attributes.go` move where the `IsErrCanceledOrKilled` needs to happen because of other changes that happened in this file. To add some words to this change: It seems to be mostly simplifying the error handling of git operations. (cherry picked from commit e524f63d58900557d7d57fc3bcd19d9facc8b8ee)
This commit is contained in:
parent
20c0a2a381
commit
171de4d107
11 changed files with 36 additions and 86 deletions
|
@ -21,7 +21,6 @@ import (
|
|||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
unit_model "code.gitea.io/gitea/models/unit"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/gitrepo"
|
||||
"code.gitea.io/gitea/modules/label"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -748,10 +747,8 @@ func updateBasicProperties(ctx *context.APIContext, opts api.EditRepoOption) err
|
|||
if opts.DefaultBranch != nil && repo.DefaultBranch != *opts.DefaultBranch && (repo.IsEmpty || ctx.Repo.GitRepo.IsBranchExist(*opts.DefaultBranch)) {
|
||||
if !repo.IsEmpty {
|
||||
if err := gitrepo.SetDefaultBranch(ctx, ctx.Repo.Repository, *opts.DefaultBranch); err != nil {
|
||||
if !git.IsErrUnsupportedVersion(err) {
|
||||
ctx.Error(http.StatusInternalServerError, "SetDefaultBranch", err)
|
||||
return err
|
||||
}
|
||||
ctx.Error(http.StatusInternalServerError, "SetDefaultBranch", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
repo.DefaultBranch = *opts.DefaultBranch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue