Description
When updating repository settings via the Gitea API (PATCH /api/v1/repos/{owner}/{repo}), attempting to enable allow_manual_merge silently fails (returns 200 OK but changes nothing) unless has_pull_requests: true is explicitly included in the same request body.
Note that has_pull_requests was already set, so should not be required.
Reproduction Steps
- Create a fresh repository
New repositories have has_pull_requests: true and allow_manual_merge: false by default.
curl -X POST -H "Authorization: token <TOKEN>" -H "Content-Type: application/json" \
-d '{"name": "repro-repo", "auto_init": true}' \
http://localhost:3000/api/v1/user/repos
- Verify Initial State
curl -s -H "Authorization: token <TOKEN>" \
http://localhost:3000/api/v1/repos/admin/repro-repo | \
jq '.has_pull_requests, .allow_manual_merge'
Output:
true
false
- Attempt to enable allow_manual_merge independently
Note that we are only sending the field we wish to change.
curl -s -X PATCH -H "Authorization: token <TOKEN>" -H "Content-Type: application/json" \
-d '{"allow_manual_merge": true}' \
http://localhost:3000/api/v1/repos/admin/repro-repo | \
jq '.has_pull_requests, .allow_manual_merge'
Output:
true
false
(Observation: The API returns 200 OK and the repo object, but allow_manual_merge remains false.)
- Verify state with a GET request
curl -s -H "Authorization: token <TOKEN>" \
http://localhost:3000/api/v1/repos/admin/repro-repo | \
jq '.has_pull_requests, .allow_manual_merge'
Output:
true
false
(Observation: The setting did not persist.)
- Attempt to enable both has_pull_requests and allow_manual_merge
curl -s -X PATCH -H "Authorization: token <TOKEN>" -H "Content-Type: application/json" \
-d '{"has_pull_requests": true, "allow_manual_merge": true}' \
http://localhost:3000/api/v1/repos/admin/repro-repo | \
jq '.has_pull_requests, .allow_manual_merge'
Output:
true
true
(Observation: The setting is now successfully updated to true.)
Expected Behavior
The API should update the allow_manual_merge field if it is provided in the payload, especially if the prerequisite (has_pull_requests) is already met on the server side. If Gitea requires certain fields to be "bundled" for validation, it should return an error (e.g., 422 Unprocessable Entity) instead of silently ignoring the field and returning 200 OK.
Observed Behavior
The allow_manual_merge field is ignored unless has_pull_requests: true is present in the same PATCH payload, regardless of the repository's current state.
Gitea Version
1.25.5
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Test Container
Database
MySQL/MariaDB
Description
When updating repository settings via the Gitea API (PATCH /api/v1/repos/{owner}/{repo}), attempting to enable
allow_manual_mergesilently fails (returns 200 OK but changes nothing) unlesshas_pull_requests: trueis explicitly included in the same request body.Note that
has_pull_requestswas already set, so should not be required.Reproduction Steps
New repositories have has_pull_requests: true and allow_manual_merge: false by default.
Note that we are only sending the field we wish to change.
(Observation: The API returns 200 OK and the repo object, but allow_manual_merge remains false.)
(Observation: The setting did not persist.)
(Observation: The setting is now successfully updated to true.)
Expected Behavior
The API should update the allow_manual_merge field if it is provided in the payload, especially if the prerequisite (has_pull_requests) is already met on the server side. If Gitea requires certain fields to be "bundled" for validation, it should return an error (e.g., 422 Unprocessable Entity) instead of silently ignoring the field and returning 200 OK.
Observed Behavior
The allow_manual_merge field is ignored unless has_pull_requests: true is present in the same PATCH payload, regardless of the repository's current state.
Gitea Version
1.25.5
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Test Container
Database
MySQL/MariaDB