diff options
author | silverwind <me@silverwind.io> | 2024-04-30 14:34:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 14:34:40 +0200 |
commit | 610802df85933e7a190a705bc3f7800da87ce868 (patch) | |
tree | 0514f3f1b732637016fda6ede226959482e7cf61 /routers/private/hook_post_receive.go | |
parent | f2d8ccc5bb2df25557cc0d4d23f2cdd029358274 (diff) | |
download | gitea-610802df85933e7a190a705bc3f7800da87ce868.tar.gz gitea-610802df85933e7a190a705bc3f7800da87ce868.zip |
Fix tautological conditions (#30735)
As discovered by https://github.com/go-gitea/gitea/pull/30729.
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'routers/private/hook_post_receive.go')
-rw-r--r-- | routers/private/hook_post_receive.go | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/routers/private/hook_post_receive.go b/routers/private/hook_post_receive.go index 769a68970d..adc435b42c 100644 --- a/routers/private/hook_post_receive.go +++ b/routers/private/hook_post_receive.go @@ -117,16 +117,14 @@ func HookPostReceive(ctx *gitea_context.PrivateContext) { } } if len(branchesToSync) > 0 { - if gitRepo == nil { - var err error - gitRepo, err = gitrepo.OpenRepository(ctx, repo) - if err != nil { - log.Error("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err) - ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{ - Err: fmt.Sprintf("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err), - }) - return - } + var err error + gitRepo, err = gitrepo.OpenRepository(ctx, repo) + if err != nil { + log.Error("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err) + ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{ + Err: fmt.Sprintf("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err), + }) + return } var ( |