Bugfixes for initCommand (#156)

respect --login parameter again

🚀

Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/156
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
6543 2020-07-18 10:43:56 +00:00
parent 2135af0304
commit 08a9a9a8ab
1 changed files with 11 additions and 0 deletions

View File

@ -81,10 +81,21 @@ var AllDefaultFlags = append([]cli.Flag{
// initCommand returns repository and *Login based on flags
func initCommand() (*Login, string, string) {
err := loadConfig(yamlConfigPath)
if err != nil {
log.Fatal("load config file failed ", yamlConfigPath)
}
login, repoPath, err := curGitRepoPath(repoValue)
if err != nil {
log.Fatal(err.Error())
}
if loginValue != "" {
login = getLoginByName(loginValue)
if login == nil {
log.Fatal("Login name " + loginValue + " does not exist")
}
}
owner, repo := splitRepo(repoPath)