Setting a value on only_mirror_protected_branches via projects API during project creation doesn't work
<!--IssueSummary start--> <details> <summary> Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards. </summary> - [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=339185) </details> <!--IssueSummary end--> ### Summary If you attempt to set `only_mirror_protected_branches` to a `true` or `false` value when creating a project through the [Projects API](https://docs.gitlab.com/ee/api/projects.html#create-project), it won't apply, and the value of the parameter will remain as `null`. However, it'll work fine if you try to change that parameter on an existing project via the Projects API. ### Steps to reproduce Create a project via the Projects API and attempt to set `only_mirror_protected_branches` to `true`. ``` curl --request POST \ --data "name=<project-name>\ &namespace_id=<namespace_id>\ &mirror=true\ &mirror_trigger_builds=true\ &only_mirror_protected_branches=true\ &import_url=https://<username>:<private-token>@gitlab.com/<example-group>/<example-project>.git" --header "PRIVATE-TOKEN: <private-token>" "https://gitlab.com/api/v4/projects/" | jq -r ``` The result of this will be: ``` "mirror_overwrites_diverged_branches": null ``` If you then try to set `only_mirror_protected_branches` to `true` on the created project via the Projects API, the intended change will succeed. ``` curl -X PUT --header "Content-Type: application/json" --header "PRIVATE-TOKEN:${TOKEN}" \ "https://gitlab.com/api/v4/projects/29081288?only_mirror_protected_branches=true&name=<project-name>" | jq -r ``` _Note: The `name` parameter is included in this example API request, even though we only want to change the value of `only_mirror_protected_branches` - This is due to a separate open issue:_ https://gitlab.com/gitlab-org/gitlab/-/issues/300101 ### What is the current *bug* behavior? The value defined for `mirror_overwrites_diverged_branches` in the API request when creating a project is never applied. ### What is the expected *correct* behavior? The value defined for `mirror_overwrites_diverged_branches` in the API request when creating a project should be applied to the project as expected.
issue