loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix tautological conditions (#30735)

As discovered by https://github.com/go-gitea/gitea/pull/30729.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 610802df85933e7a190a705bc3f7800da87ce868)

Conflicts:
tests/integration/git_test.go
trivial conflict because of https://codeberg.org/forgejo/forgejo/pulls/2834

authored by

silverwind
Giteabot
and committed by
Earl Warren
9792a377 51b8d964

+20 -23
+8 -10
routers/private/hook_post_receive.go
··· 114 114 } 115 115 } 116 116 if len(branchesToSync) > 0 { 117 - if gitRepo == nil { 118 - var err error 119 - gitRepo, err = gitrepo.OpenRepository(ctx, repo) 120 - if err != nil { 121 - log.Error("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err) 122 - ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{ 123 - Err: fmt.Sprintf("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err), 124 - }) 125 - return 126 - } 117 + var err error 118 + gitRepo, err = gitrepo.OpenRepository(ctx, repo) 119 + if err != nil { 120 + log.Error("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err) 121 + ctx.JSON(http.StatusInternalServerError, private.HookPostReceiveResult{ 122 + Err: fmt.Sprintf("Failed to open repository: %s/%s Error: %v", ownerName, repoName, err), 123 + }) 124 + return 127 125 } 128 126 129 127 var (
+1 -1
services/auth/source/oauth2/providers.go
··· 182 182 } 183 183 184 184 // always set the name if provider is created so we can support multiple setups of 1 provider 185 - if err == nil && provider != nil { 185 + if provider != nil { 186 186 provider.SetName(providerName) 187 187 } 188 188
+8 -6
services/convert/issue.go
··· 211 211 IsArchived: label.IsArchived(), 212 212 } 213 213 214 + labelBelongsToRepo := label.BelongsToRepo() 215 + 214 216 // calculate URL 215 - if label.BelongsToRepo() && repo != nil { 216 - if repo != nil { 217 - result.URL = fmt.Sprintf("%s/labels/%d", repo.APIURL(), label.ID) 218 - } else { 219 - log.Error("ToLabel did not get repo to calculate url for label with id '%d'", label.ID) 220 - } 217 + if labelBelongsToRepo && repo != nil { 218 + result.URL = fmt.Sprintf("%s/labels/%d", repo.APIURL(), label.ID) 221 219 } else { // BelongsToOrg 222 220 if org != nil { 223 221 result.URL = fmt.Sprintf("%sapi/v1/orgs/%s/labels/%d", setting.AppURL, url.PathEscape(org.Name), label.ID) 224 222 } else { 225 223 log.Error("ToLabel did not get org to calculate url for label with id '%d'", label.ID) 226 224 } 225 + } 226 + 227 + if labelBelongsToRepo && repo == nil { 228 + log.Error("ToLabel did not get repo to calculate url for label with id '%d'", label.ID) 227 229 } 228 230 229 231 return result
+3 -6
tests/integration/git_test.go
··· 83 83 rawTest(t, &httpContext, little, big, littleLFS, bigLFS) 84 84 mediaTest(t, &httpContext, little, big, littleLFS, bigLFS) 85 85 86 - t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "master", "test/head")) 86 + t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &httpContext, "test/head")) 87 87 t.Run("InternalReferences", doInternalReferences(&httpContext, dstPath)) 88 88 t.Run("BranchProtectMerge", doBranchProtectPRMerge(&httpContext, dstPath)) 89 89 t.Run("AutoMerge", doAutoPRMerge(&httpContext, dstPath)) ··· 125 125 rawTest(t, &sshContext, little, big, littleLFS, bigLFS) 126 126 mediaTest(t, &sshContext, little, big, littleLFS, bigLFS) 127 127 128 - t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &sshContext, "master", "test/head2")) 128 + t.Run("CreateAgitFlowPull", doCreateAgitFlowPull(dstPath, &sshContext, "test/head2")) 129 129 t.Run("InternalReferences", doInternalReferences(&sshContext, dstPath)) 130 130 t.Run("BranchProtectMerge", doBranchProtectPRMerge(&sshContext, dstPath)) 131 131 t.Run("MergeFork", func(t *testing.T) { ··· 332 332 return "", err 333 333 } 334 334 written += n 335 - } 336 - if err != nil { 337 - return "", err 338 335 } 339 336 340 337 // Commit ··· 750 747 } 751 748 } 752 749 753 - func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headBranch string) func(t *testing.T) { 750 + func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, headBranch string) func(t *testing.T) { 754 751 return func(t *testing.T) { 755 752 defer tests.PrintCurrentTest(t)() 756 753