From 03ed7cd52a6501b47a3cc59c4956da96417288a8 Mon Sep 17 00:00:00 2001 From: eliska-n Date: Tue, 17 Dec 2024 12:29:57 +0100 Subject: [PATCH] return if there's error in init. do not set the library ready --- asab/library/providers/git.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/asab/library/providers/git.py b/asab/library/providers/git.py index faf05329..a50052e8 100644 --- a/asab/library/providers/git.py +++ b/asab/library/providers/git.py @@ -131,6 +131,7 @@ def init_task(): ) else: L.exception("Error when initializing git repository: {}".format(pygit_message)) + return except pygit2.GitError as err: pygit_message = str(err).replace('\"', '') @@ -171,9 +172,11 @@ def init_task(): ) else: L.exception("Git repository not initialized: {}".format(err)) + return except Exception as err: L.exception(err) + return assert hasattr(self.GitRepository, "remotes"), "Git repository not initialized." assert self.GitRepository.remotes["origin"] is not None, "Git repository not initialized."