Skip to content

Extending API for protected branches

What does this MR do?

Creates a new "protected_branches" API which allows performing CRUD actions directly on protected branches, rather than operating on git branches. The API adds the following

  • Create/modify wildcard protected branches
  • Set the allowed to push/merge setting to "Developers + Masters", "Masters", or "No one"

Are there points in the code the reviewer needs to double check?

This is my first time contributing, so just making sure that the code adheres to the Gitlab guidelines.

Why was this MR needed?

The current method of protecting/unprotecting branches via the API is through the branches API, which does not mirror the internal data model for protected branches, and is lacking several features. This MR adds the functionality given by the UI to the API.

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

#30102 (closed)

Edited by username-removed-1415304

Merge request reports