aboutsummaryrefslogtreecommitdiffstats
path: root/routers/private
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-11-02 19:20:22 +0800
committerGitHub <noreply@github.com>2024-11-02 11:20:22 +0000
commite524f63d58900557d7d57fc3bcd19d9facc8b8ee (patch)
tree205126f1134cce89b2a19faff2f1cfc48ad61adb /routers/private
parent13a203828c40f9ad1005b16b4ae26256a7df8263 (diff)
downloadgitea-e524f63d58900557d7d57fc3bcd19d9facc8b8ee.tar.gz
gitea-e524f63d58900557d7d57fc3bcd19d9facc8b8ee.zip
Fix git error handling (#32401)
Diffstat (limited to 'routers/private')
-rw-r--r--routers/private/default_branch.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/routers/private/default_branch.go b/routers/private/default_branch.go
index 03c19c8ff4..8f6e9084df 100644
--- a/routers/private/default_branch.go
+++ b/routers/private/default_branch.go
@@ -8,7 +8,6 @@ import (
"net/http"
repo_model "code.gitea.io/gitea/models/repo"
- "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/gitrepo"
"code.gitea.io/gitea/modules/private"
gitea_context "code.gitea.io/gitea/services/context"
@@ -23,12 +22,10 @@ func SetDefaultBranch(ctx *gitea_context.PrivateContext) {
ctx.Repo.Repository.DefaultBranch = branch
if err := gitrepo.SetDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.Repository.DefaultBranch); err != nil {
- if !git.IsErrUnsupportedVersion(err) {
- 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.JSON(http.StatusInternalServerError, private.Response{
+ Err: fmt.Sprintf("Unable to set default branch on repository: %s/%s Error: %v", ownerName, repoName, err),
+ })
+ return
}
if err := repo_model.UpdateDefaultBranch(ctx, ctx.Repo.Repository); err != nil {