Draft: Put actual default branch in readme on project creation
What does this MR do and why?
Describe in detail what your merge request does and why.
Put actual default branch in readme on project creation
Adds test for when the user specifies a default branch, rather than relying on the system default.
There are two issues going on here. The first is that gitaly uses a heuristic to determine the default branch, and this heuristic returns nothing when no branches exist. This means when the template uses project.default_branch_or_main since there aren't any branches yet, gitaly returns nothing, so the system-wide default us used instead.
The other issue is that the default branch was never actually passed into project.create_repository, instead this service was relying on the fact that the same heuristic in gitaly will return the only branch that exists as the default branch. Once this branch is created, gitlab-rails then updates HEAD with a hook.
The heuristic is quite unintuitive and gitaly are looking to remove it which should allow this code to be simplified in the future.
Changelog: fixed
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.