Use instance defaults for source branch removal

What does this MR do and why?

Contributes to #465720 (closed)

Problem

The source branch removal option is hard-coded to enabled for new projects, so administrators cannot choose a different instance default.

Solution

  • Store the source branch removal default in application settings.
  • Use the instance default when creating projects and forks.
  • Expose the setting through the application settings API.
  • Document and test the setting across models, services, and the API.

References

Relates to #465720 (closed)

Stack order:

  1. !260679 (merged): database foundation
  2. This MR: backend setting, project default, and API
  3. 465720-default-remove-source-branch-admin-ui

How to set up and validate locally

  1. In a Rails console, set the instance default:
    ApplicationSetting.current.update!(
      default_remove_source_branch_after_merge: false
    )
  2. Create a new project and verify that source branch removal is disabled by default.
  3. Create a fork and verify that it uses the instance default.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Vasilii Iakliushin

Merge request reports

Loading
Loading