From 08a9a9a8ab52730b3555eb56cfdfe05e012c023f Mon Sep 17 00:00:00 2001 From: 6543 <6543@noreply.gitea.io> Date: Sat, 18 Jul 2020 10:43:56 +0000 Subject: [PATCH] Bugfixes for initCommand (#156) respect --login parameter again :rocket: Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/156 Reviewed-by: Lunny Xiao Reviewed-by: Andrew Thornton --- cmd/flags.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/flags.go b/cmd/flags.go index 84b4fe5..c503e56 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -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)