Skip to content

Create a protected branches API

Description

  • Currently, the only way to protect/unprotect a branch via the API is to use the branches API
  • The branches API does not mirror the internal data model for protected branches - this can't be changed due to backward compatibility
  • This causes a number of edge cases in the code that glues these two data models together

Proposal

  • Create a new "protected_branches" API that allows performing CRUD actions directly on protected branches, rather than operating on git branches
  • The API should allow performing all actions that are currently possible through the web interface:
    • Create a wildcard protected branch
    • Set the "Allowed to push" setting to "Developers", "No one", or "Developers + Masters"
    • Set the "Allowed to push" setting to any combination of the above, in addition to specific users and groups (EE-only)
    • Set the "Allowed to merge" setting to "Developers" or "Developers + Masters"
    • Set the "Allowed to merge" setting to any combination of the above, in addition to specific users and groups (EE-only)

Links / references

Issues that can be closed once this API is implemented: #30009 (moved), #27371 (closed), #22317 (closed), #20369 (closed), #27062 (closed)