From e524f63d58900557d7d57fc3bcd19d9facc8b8ee Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 2 Nov 2024 19:20:22 +0800 Subject: Fix git error handling (#32401) --- routers/api/v1/repo/repo.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'routers/api/v1') diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 698ba3cc94..69a95dd5a5 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -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" @@ -739,10 +738,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 } updateRepoLicense = true } -- cgit v1.2.3