update_manager: explicitly check if a repo path contains a .git folder

This allows the repo init sequence to distinguish between a broken git repo and an invalid git repo.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Arksine committed 2021-03-12 08:40:49 -05:00
1 parent 9988da72c1
commit 832eb6f130
1 file changed
+6 -2
+6 -2
View File
@@ -804,6 +804,11 @@ class GitRepo:
async def update_repo_status(self):
async with self.git_operation_lock:
if not os.path.isdir(os.path.join(self.git_path, ".git")):
logging.info(
f"Git Repo {self.alias}: path '{self.git_path}'"
" is not a valid git repo")
return False
try:
resp = await self.cmd_helper.run_cmd_with_response(
f"{self.git_cmd} status -u no")
@@ -869,8 +874,7 @@ class GitRepo:
def _verify_repo(self, check_remote=False):
if not self.valid_git_repo:
raise self.server.error(
f"Git Repo {self.alias}: '{self.git_path}' "
"not a git repository")
f"Git Repo {self.alias}: repo not initialized")
if check_remote:
if self.git_remote == "?":
raise self.server.error(