From c01acd7cb96a127114b623c5167b60ce23a24565 Mon Sep 17 00:00:00 2001 From: Luis Helder Date: Mon, 17 Apr 2023 14:01:58 -0300 Subject: [PATCH] fix: handle missing git command when getting local version --- hathor/version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hathor/version.py b/hathor/version.py index 7ec001bd9..d7ee89da7 100644 --- a/hathor/version.py +++ b/hathor/version.py @@ -53,9 +53,9 @@ def _get_build_version() -> Optional[str]: def _get_git_revision_short_hash() -> Optional[str]: try: return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip() - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, FileNotFoundError): logger.warn(( - "Error while trying to get local git head. We are probably not in a git repo. " + "Error while trying to get local git head. There is either no git available or we aren't in a git repo. " "Will report local version without any git info." )) return None