From 329200b1efde91da3c558850a475cb2b67485e93 Mon Sep 17 00:00:00 2001 From: Norwin Date: Tue, 29 Mar 2022 08:01:37 +0800 Subject: [PATCH] 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 Reviewed-on: https://gitea.com/gitea/tea/pulls/472 Reviewed-by: Andrew Thornton Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Norwin Co-committed-by: Norwin --- modules/context/context.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/context/context.go b/modules/context/context.go index 9c670c6..4ec42bf 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -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