Fix running in repos without remote (#472)

For tea, the case of no remotes in the local repo context is equal to `errNotAGiteaRepo`.
This error type is already gracefully handled, so with this change, tea doesn't reject working from a repo without remotes.

fixes #455, closes #465

Co-authored-by: Norwin <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/472
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Norwin <noerw@noreply.gitea.io>
Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
Norwin 2022-03-29 08:01:37 +08:00 committed by 6543
parent 6663d9f19b
commit 329200b1ef
1 changed files with 1 additions and 2 deletions

View File

@ -157,9 +157,8 @@ func contextFromLocalRepo(repoPath, remoteValue string) (*git.TeaRepo, *config.L
return repo, nil, "", err
}
// if no remote
if len(gitConfig.Remotes) == 0 {
return repo, nil, "", errors.New("No remote(s) found in this Git repository")
return repo, nil, "", errNotAGiteaRepo
}
// When no preferred value is given, choose a remote to find a