From 654191113e2eb31e57daa4d69aeb3fe052bced5e Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 5 Jun 2014 23:02:58 +0000 Subject: [PATCH] Check for git before querying it for a version * pbr/packaging.py(_get_version_from_git): Wrap calls to _run_git_command in a conditional check for _git_is_installed to avoid an opaque error message which can occur when you have a .git directory but no git executable. Change-Id: I6752c93d393a941daa1e7fb949c7c3d2a75337f3 Closes-Bug: #1326682 --- pbr/packaging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pbr/packaging.py b/pbr/packaging.py index d6aeb649..a998ceb8 100644 --- a/pbr/packaging.py +++ b/pbr/packaging.py @@ -801,7 +801,7 @@ def _get_version_from_git(pre_version): """ git_dir = _get_git_directory() - if git_dir: + if git_dir and _git_is_installed(): if pre_version: try: return _run_git_command(