From 6a83fffb5933f8277e45e7000b199391f62e34a9 Mon Sep 17 00:00:00 2001 From: Viacheslav Kukushkin Date: Wed, 10 Apr 2024 13:02:50 +0300 Subject: [PATCH] git-updates skipped if package not installed from repo with -e flag --- cli/medperf/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/medperf/utils.py b/cli/medperf/utils.py index 2636c6a9d..a930ffb1b 100644 --- a/cli/medperf/utils.py +++ b/cli/medperf/utils.py @@ -19,7 +19,7 @@ from typing import List from colorama import Fore, Style from pexpect.exceptions import TIMEOUT -from git import Repo, GitCommandError +from git import Repo, GitCommandError, InvalidGitRepositoryError import medperf.config as config from medperf.exceptions import ExecutionError, MedperfException @@ -431,7 +431,11 @@ def filter_latest_associations(associations, entity_key): def check_for_updates() -> None: """Check if the current branch is up-to-date with its remote counterpart using GitPython.""" repo_root_dir = Path(__file__).resolve().parent.parent.parent - repo = Repo(repo_root_dir) + try: + repo = Repo(repo_root_dir) + except InvalidGitRepositoryError: # package is installed not in -e mode from git repo + return + if repo.bare: logging.debug("Repo is bare") return