mirror of
https://gitea.com/gitea/tea.git
synced 2024-11-22 10:31:37 +01:00
Don't skip reading the local repo when --repo
specifies a repo slug (#398)
I added this check in #327, but it wasn't needed at all as the error case it intended to catch where already handled by checking if the path exists. fixes #378 Co-authored-by: Norwin <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/398 Reviewed-by: 6543 <6543@obermui.de> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
parent
7b7c7f57be
commit
1731e00ebd
@ -99,8 +99,8 @@ func InitCommand(ctx *cli.Context) *TeaContext {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(repoFlag) == 0 || repoFlagPathExists {
|
// try to read local git repo & extract context: if repoFlag specifies a valid path, read repo in that dir,
|
||||||
// try to read git repo & extract context, ignoring if PWD is not a repo
|
// otherwise attempt PWD. if no repo is found, continue with default login
|
||||||
if c.LocalRepo, c.Login, c.RepoSlug, err = contextFromLocalRepo(repoPath, remoteFlag); err != nil {
|
if c.LocalRepo, c.Login, c.RepoSlug, err = contextFromLocalRepo(repoPath, remoteFlag); err != nil {
|
||||||
if err == errNotAGiteaRepo || err == gogit.ErrRepositoryNotExists {
|
if err == errNotAGiteaRepo || err == gogit.ErrRepositoryNotExists {
|
||||||
// we can deal with that, commands needing the optional values use ctx.Ensure()
|
// we can deal with that, commands needing the optional values use ctx.Ensure()
|
||||||
@ -108,7 +108,6 @@ func InitCommand(ctx *cli.Context) *TeaContext {
|
|||||||
log.Fatal(err.Error())
|
log.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if len(repoFlag) != 0 && !repoFlagPathExists {
|
if len(repoFlag) != 0 && !repoFlagPathExists {
|
||||||
// if repoFlag is not a valid path, use it to override repoSlug
|
// if repoFlag is not a valid path, use it to override repoSlug
|
||||||
|
Loading…
Reference in New Issue
Block a user