Merge Request Squash Settings per protected branch (non-wildcard only)
<!-- The first section "Release notes" is required if you want to have your release post blog MR auto generated. Currently in BETA, details on the **release post item generator** can be found in the handbook: https://about.gitlab.com/handbook/marketing/blog/release-posts/#release-post-item-generator and this video: https://www.youtube.com/watch?v=rfn9ebgTwKg. The next four sections: "Problem to solve", "Intended users", "User experience goal", and "Proposal", are strongly recommended in your first draft, while the rest of the sections can be filled out during the problem validation or breakdown phase. However, keep in mind that providing complete and relevant information early helps our product team validate the problem and start working on a solution. -->
### Release notes
Override a project's `squash commits when merging` setting for a protected branch.
### Problem to solve
We would like to be able to set the squash behavior to `Encourage` for the `develop` branch while it should be `Do not allow` on the `main` branch.
> * I need to be able to "require squash" on protected branches
> * because otherwise high-volume branches become a horrible mess - when you have hundreds of devs active daily on a single project, a clean trunk/protected-branch history is critical and "oh, just teach them to rebase and squash themselves" is nonsense
> * note that this is also a motivation for related high-popularity issue https://gitlab.com/gitlab-org/gitlab/-/issues/1822, which looked like it was finally getting some attention in 16.10, but then... didn't.
> * I need to be able to **not** require squash on non-protected branches (even though I do on protected branches)
> * because using MRs to "merge down" from protected to team feature branches can be helpful for teams (and squashing such "merge down" MRs completely breaks merge history / makes no sense), and also because doing regular merges from user/story branches to shared feature/wip branches can also be helpful for teams
This is no longer in scope, moved to https://gitlab.com/gitlab-org/gitlab/-/issues/504399+:
> * I need to be able to **merge** _between protected branches_ (even though I require squash from non-protected to protected branches) - which is a possibly-separate requirement captured in https://gitlab.com/gitlab-org/gitlab/-/issues/24452
> * because squashing between protected branches almost never makes sense (and merges between protected branches are a common thing in eg gitflow). the only time we should **require** squashing, is when merging from a non-protected branch to a protected branch
### Intended users
Project owners and maintainers
### User experience goal
The user should be able to override the squash behavior on a protected branch.
### Proposal
Branch specific squash rules should be added so that you can specify the rules for the branches the merge requests are merged into
1. Introduce squash behaviour overrides
- Add opens a drawer
- Select target protected branch
- Selection of squashing behaviour similar to existing default behaviour selection
- Do not allow
- Allow
- Encourage
- Require
| Scenario | Design |
| ------ | ------ |
| Default |  |
| With protected branch override |  |
| Add target branch - drawer |  |
Note this mockup is out of date. These will now be added to Branch Rules. The `prevent squashing commits from protected branches` checkbox is not within the scope of this issue and will be tracked through https://gitlab.com/gitlab-org/gitlab/-/issues/24452+
The scope is limited to non-wildcard protected branches only. We may iterate on this in the future to allow wildcard branch rules to specify these overrides, currently we have no mechanism to resolve conflicts so this is not possible. For now `All branches` and `All protected branches` branch rules are also not eligible.
### Further details
Benefits: Enforcing this will reduce risk of people not following the team internal squash policy
### Permissions and Security
Project maintainers and owners can view/create/edit branch rules.
### Documentation
<!-- See the Feature Change Documentation Workflow https://docs.gitlab.com/ee/development/documentation/workflow.html#for-a-product-change
* Add all known Documentation Requirements in this section. See https://docs.gitlab.com/ee/development/documentation/feature-change-workflow.html#documentation-requirements
* If this feature requires changing permissions, update the permissions document. See https://docs.gitlab.com/ee/user/permissions.html -->
### Availability & Testing
<!-- This section needs to be retained and filled in during the workflow planning breakdown phase of this feature proposal, if not earlier.
What risks does this change pose to our availability? How might it affect the quality of the product? What additional test coverage or changes to tests will be needed? Will it require cross-browser testing?
Please list the test areas (unit, integration and end-to-end) that needs to be added or updated to ensure that this feature will work as intended. Please use the list below as guidance.
* Unit test changes
* Integration test changes
* End-to-end test change
See the test engineering planning process and reach out to your counterpart Software Engineer in Test for assistance: https://about.gitlab.com/handbook/engineering/quality/test-engineering/#test-planning -->
### What does success look like, and how can we measure that?
<!--
Define both the success metrics and acceptance criteria. Note that success metrics indicate the desired business outcomes, while acceptance criteria indicate when the solution is working correctly. If there is no way to measure success, link to an issue that will implement a way to measure this.
Create tracking issue using the the Snowplow event tracking template. See https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/issue_templates/Snowplow%20event%20tracking.md
-->
### What is the type of buyer?
<!-- What is the buyer persona for this feature? See https://about.gitlab.com/handbook/marketing/product-marketing/roles-personas/buyer-persona/
In which enterprise tier should this feature go? See https://about.gitlab.com/handbook/product/pricing/#four-tiers -->
### Is this a cross-stage feature?
<!-- Communicate if this change will affect multiple Stage Groups or product areas. We recommend always start with the assumption that a feature request will have an impact into another Group. Loop in the most relevant PM and Product Designer from that Group to provide strategic support to help align the Group's broader plan and vision, as well as to avoid UX and technical debt. https://about.gitlab.com/handbook/product/#cross-stage-features -->
### Links / references
<!-- Label reminders - you should have one of each of the following labels.
Read the descriptions on https://gitlab.com/gitlab-org/gitlab/-/labels to find the correct ones -->
https://gitlab.com/gitlab-org/gitlab/-/work_items/500458+
issue