summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2014-12-17 14:21:35 -0800
committerClark Boylan <clark.boylan@gmail.com>2014-12-17 14:21:35 -0800
commite7d2825d39fce2111d0d413e63e553603a0e56fb (patch)
tree650d07fc34f82f4f283cfdfbbbe76707c0179fa3
parent5dd31ac46b8b5b7d3b0e1fb123f653ac915eeac6 (diff)
downloadpbr-e7d2825d39fce2111d0d413e63e553603a0e56fb.tar.gz
Properly check for git before getting git dir0.10.4
We cannot get the git dir if git is not installed. Check that git is installed before querying for the git dir. Return None if the git dir cannot be found or if git is not installed. Change-Id: Ic8e0c74a779b23842369a8cf01fcbf37885202ef Fixes-bug: 1326682
-rw-r--r--pbr/packaging.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pbr/packaging.py b/pbr/packaging.py
index 294421d..35f2cab 100644
--- a/pbr/packaging.py
+++ b/pbr/packaging.py
@@ -246,7 +246,7 @@ def write_git_changelog(git_dir=None, dest_dir=os.path.curdir,
return
log.info('[pbr] Writing ChangeLog')
if git_dir is None:
- git_dir = _get_git_directory()
+ git_dir = _run_git_functions()
if not git_dir:
return
@@ -306,7 +306,7 @@ def generate_authors(git_dir=None, dest_dir='.', option_dict=dict()):
log.info('[pbr] Generating AUTHORS')
ignore_emails = '(jenkins@review|infra@lists|jenkins@openstack)'
if git_dir is None:
- git_dir = _get_git_directory()
+ git_dir = _run_git_functions()
if git_dir:
authors = []
@@ -341,7 +341,7 @@ def _find_git_files(dirname='', git_dir=None):
"""
file_list = []
if git_dir is None and _git_is_installed():
- git_dir = _get_git_directory()
+ git_dir = _run_git_functions()
if git_dir:
log.info("[pbr] In git context, generating filelist from git")
file_list = _run_git_command(['ls-files', '-z'], git_dir)
@@ -637,10 +637,10 @@ def get_is_release(git_dir):
def _run_git_functions():
- git_dir = _get_git_directory()
- if git_dir and _git_is_installed():
- return git_dir
- return None
+ git_dir = None
+ if _git_is_installed():
+ git_dir = _get_git_directory()
+ return git_dir or None
def get_git_short_sha(git_dir=None):