-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
PATCH /api/v1/repos/OWNER/REPO fails #20522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is a rather unfriendly 'feature' of the API — the request needs to contain gitea/routers/api/v1/repo/repo.go Line 834 in c9c5bd8
...as is also noted in the docs: Lines 186 to 187 in c9c5bd8
As this usage error comes up repeatedly (#13620 #15121 #18773 #19069), I take this opportunity to discuss if
Opinions? @6543 Edit: sample for proposed new behaviour:diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index cdd1f7d5c..1ba97c637 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -830,8 +830,9 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
}
}
- if opts.HasPullRequests != nil {
- if *opts.HasPullRequests && !unit_model.TypePullRequests.UnitGlobalDisabled() {
+ if opts.HasPullRequests != nil && !*opts.HasPullRequests {
+ deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
+ } else if !unit_model.TypePullRequests.UnitGlobalDisabled() {
// We do allow setting individual PR settings through the API, so
// we get the config settings and then set them
// if those settings were provided in the opts.
@@ -891,9 +892,6 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
Type: unit_model.TypePullRequests,
Config: config,
})
- } else if !*opts.HasPullRequests && !unit_model.TypePullRequests.UnitGlobalDisabled() {
- deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
- }
}
if opts.HasProjects != nil && !unit_model.TypeProjects.UnitGlobalDisabled() { |
I would accept a patch if submited |
This is really odd. I read the related documentation, but I understood it as "you can only set this setting if the existing repo already has But having to send that Thanks for the clarification. |
Parent issue #13622 |
This PR would presumably Fix #20522 Fix #18773 Fix #19069 Fix #21077 Fix #13622 ----- 1. Check whether unit type is currently enabled 2. Check if it _will_ be enabled via opt 3. Allow modification as necessary Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
Description
I'm trying to use the API to programmatically update the default_merge_style to 'rebase'.
The HTTP PATCH looks rather simple, I'm doing something like this from python:
When enabling the HTTPConnection.debuglevel of the python client, I get:
So what's odd here is
{"default_merge_style": "rebase"}
{"default_merge_style": "merge"}
- which was the setting before issuing the patch.The same problem is also observed when trying to change the
allow_squash_merge
in a similar PATCHGitea Version
1.16.8
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
Debian GNU/Linux 11
How are you running Gitea?
gitea docker container
Database
SQLite
The text was updated successfully, but these errors were encountered: