1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Check for 'main' as potential default branch name (#14193)

This commit is contained in:
Chester Liu
2020-12-30 23:46:26 +08:00
committed by GitHub
parent c074e46292
commit 632800eda7
3 changed files with 11 additions and 2 deletions

View File

@ -412,8 +412,8 @@ func HookPostReceive(ctx *macaron.Context, opts private.HookOptions) {
RepoName: repoName,
}
updates = append(updates, &option)
if repo.IsEmpty && option.IsBranch() && option.BranchName() == "master" {
// put the master branch first
if repo.IsEmpty && option.IsBranch() && (option.BranchName() == "master" || option.BranchName() == "main") {
// put the master/main branch first
copy(updates[1:], updates)
updates[0] = &option
}