Rename default_branch_or_master to default_branch_or_main [RUN ALL RSPEC] [RUN AS-IF-FOSS]

Merged Igor Drozdov requested to merge id-rename-default_branch_or_master into master

What does this MR do?

Related issue:

Let's rename the method and return main when default branch is not set.

In most cases it shouldn't change the product behavior because the default branch logic is provided by Gitaly and if master exists in the repo, the branch will be returned: gitaly@891fd307.

But in the cases when a project is empty, Gitaly returns nil as a default branch, so we can control it by ourselves and force main instead. When the first branch is created, Gitaly returns this first branch as a default one and then it's set by Gitlab Rails as default:

User facing changes

For example, when a project is empty, the Add README (and other) buttons will create a file in main branch by default:


Edited by Igor Drozdov