gitea/models
silverwind 761b9d439b
Fix API not persisting pull request unit config when has_pull_requests is not set (#36718)
The `PATCH /api/v1/repos/{owner}/{repo}` endpoint silently ignores pull
request config fields (like `default_delete_branch_after_merge`,
`allow_squash_merge`, etc.) unless `has_pull_requests: true` is also
included in the request body. This is because the entire PR unit config
block was gated behind `if opts.HasPullRequests != nil`.

This PR restructures the logic so that PR config options are applied
whenever the pull request unit already exists on the repo, without
requiring `has_pull_requests` to be explicitly set. A new unit is only
created when `has_pull_requests: true` is explicitly sent.

Fixes https://github.com/go-gitea/gitea/issues/36466
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2026-03-02 22:08:53 +00:00
..
actions Move jobparser from act repository to Gitea (#36699) 2026-02-22 19:33:01 +00:00
activities Load heatmap data asynchronously (#36622) 2026-02-17 14:03:55 +00:00
admin Don't block site admin's operation if SECRET_KEY is lost (#35721) 2025-10-22 12:35:56 +08:00
asymkey Enable `nilnil` linter for new code (#36591) 2026-02-16 09:57:18 +00:00
auth Implements OIDC RP-Initiated Logout (#36724) 2026-03-01 06:28:26 +00:00
avatars Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
db Enable `nilnil` linter for new code (#36591) 2026-02-16 09:57:18 +00:00
dbfs Enable `nilnil` linter for new code (#36591) 2026-02-16 09:57:18 +00:00
fixtures Fix get release draft permission check (#36659) 2026-02-22 20:56:46 +00:00
git Delete non-exist branch should return 404 (#36694) 2026-03-02 11:08:16 -08:00
issues Correct spelling (#36783) 2026-02-28 11:23:20 -08:00
migrations Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
organization Correct spelling (#36783) 2026-02-28 11:23:20 -08:00
packages fix(packages/container): data race when uploading container blobs concurrently (#36524) 2026-02-04 00:08:20 +08:00
perm Bump golangci-lint to 2.7.2, enable modernize stringsbuilder (#36180) 2025-12-17 20:50:53 +00:00
project Fix permission check on org project operations (#36318) 2026-01-14 17:29:33 +00:00
pull Fix incorrect viewed files counter if file has changed (#36009) 2025-11-27 14:02:03 +00:00
renderhelper fix: generate IDs for HTML headings without id attribute (#36233) 2026-01-06 05:09:44 +00:00
repo Fix API not persisting pull request unit config when has_pull_requests is not set (#36718) 2026-03-02 22:08:53 +00:00
secret Don't block site admin's operation if SECRET_KEY is lost (#35721) 2025-10-22 12:35:56 +08:00
shared/types Refactor locale&string&template related code (#29165) 2024-02-14 21:48:45 +00:00
system Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
unit Run `gopls modernize` on codebase (#34751) 2025-06-18 01:48:09 +00:00
unittest Clean up Makefile, tests and legacy code (#36638) 2026-02-19 01:23:32 +00:00
user Refactor avatar package, support default avatar fallback (#36788) 2026-03-01 13:32:35 +00:00
webhook Add paging headers (#36521) 2026-02-06 13:12:05 +00:00
main_test.go make writing main test easier (#27270) 2023-09-28 01:38:53 +00:00
repo.go Use db.WithTx/WithTx2 instead of TxContext when possible (#35130) 2025-07-22 10:02:01 -07:00
repo_test.go Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00