Update to default branch on project via GUI or API fails to take affect
Summary
When attempting to modify the default branch on a project, let's say, from main
to development
and saving the changes via the GUI, the GUI reports Project settings were successfully updated
, but upon page refresh the default branch is still set to main
.
Using the Projects API to attempt the change returns a 200
code but the change is not reflected either.
Steps to reproduce
We have not been able to recreate this behavior, but it is affecting a specific GitLab.com project when following these steps:
- Open the project via the GUI.
- Go into
Settings -> Repository
. - Expand the
Branch defaults
section. - Select the new default branch from the dropdown (
development
in this case). - Click
Save changes
. - Refresh the page and notice the default branch is still set to the previous value instead of
development
.
Example Project
Unable to recreate.
What is the current bug behavior?
The default branch is still set to the previous value.
What is the expected correct behavior?
The default branch is properly updated.
Relevant logs and/or screenshots
When the affected user clicks on Save changes
and attempts to update the default branch, the following call to the Projects::Settings::RepositoryController
is logged by GitLab which properly displays the desired change, in the production_json
log:
"params": [
{
"key": "_method",
"value": "put"
},
{
"key": "authenticity_token",
"value": "[FILTERED]"
},
{
"key": "update_section",
"value": "js-issue-settings"
},
{
"value": "{\"default_branch\"=>\"development\", \"autoclose_referenced_issues\"=>\"1\", \"issue_branch_template\"=>\"\"}",
"key": "project"
},
{
"key": "namespace_id",
"value": "[REDACTED]"
},
{
"value": "[REDACTED]",
"key": "project_id"
}
]
The audit_json
log however displays the following message, showing that the default branch was not changed:
Default branch changed from main to main
Team members with access to Kibana for GitLab.com may review the full details here.
Output of checks
This bug happens on GitLab.com
Possible fixes
A recent change to the default branch setting's location may be related.