mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-03 04:27:21 -05:00
Accept more main branch names for login detection (#396)
Also consider `main` and `trunk` as options to determine a login through its configured remote fixes #381 Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/396 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Alexey 〒erentyev <axifive@noreply.gitea.io> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
parent
808e8b1c5a
commit
6e728cf812
@ -166,11 +166,15 @@ func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.L
|
|||||||
}
|
}
|
||||||
if len(gitConfig.Remotes) > 1 {
|
if len(gitConfig.Remotes) > 1 {
|
||||||
// if master branch is present, use it as the default remote
|
// if master branch is present, use it as the default remote
|
||||||
masterBranch, ok := gitConfig.Branches["master"]
|
mainBranches := []string{"main", "master", "trunk"}
|
||||||
|
for _, b := range mainBranches {
|
||||||
|
masterBranch, ok := gitConfig.Branches[b]
|
||||||
if ok {
|
if ok {
|
||||||
if len(masterBranch.Remote) > 0 {
|
if len(masterBranch.Remote) > 0 {
|
||||||
remoteValue = masterBranch.Remote
|
remoteValue = masterBranch.Remote
|
||||||
}
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user