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:
parent
9988da72c1
commit
832eb6f130
|
@ -804,6 +804,11 @@ class GitRepo:
|
||||||
|
|
||||||
async def update_repo_status(self):
|
async def update_repo_status(self):
|
||||||
async with self.git_operation_lock:
|
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:
|
try:
|
||||||
resp = await self.cmd_helper.run_cmd_with_response(
|
resp = await self.cmd_helper.run_cmd_with_response(
|
||||||
f"{self.git_cmd} status -u no")
|
f"{self.git_cmd} status -u no")
|
||||||
|
@ -869,8 +874,7 @@ class GitRepo:
|
||||||
def _verify_repo(self, check_remote=False):
|
def _verify_repo(self, check_remote=False):
|
||||||
if not self.valid_git_repo:
|
if not self.valid_git_repo:
|
||||||
raise self.server.error(
|
raise self.server.error(
|
||||||
f"Git Repo {self.alias}: '{self.git_path}' "
|
f"Git Repo {self.alias}: repo not initialized")
|
||||||
"not a git repository")
|
|
||||||
if check_remote:
|
if check_remote:
|
||||||
if self.git_remote == "?":
|
if self.git_remote == "?":
|
||||||
raise self.server.error(
|
raise self.server.error(
|
||||||
|
|
Loading…
Reference in New Issue