Skip to content

Commit

Permalink
feat(git): Omit git info when git isnt installed
Browse files Browse the repository at this point in the history
Addresses this comment: #174 (comment)

Previously, git info was omitted if git was installed but the .git directory was missing.
This fix will also omit git info in case git itself is missing (unless, of course, the environment args are there).
  • Loading branch information
nirizr committed Sep 12, 2018
1 parent 84198b4 commit 10f0558
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions coveralls/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def git_info():
remotes = [{'name': line.split()[0], 'url': line.split()[1]}
for line in run_command('git', 'remote', '-v').splitlines()
if '(fetch)' in line]
except CoverallsException as ex:
except (CoverallsException, EnvironmentError):
# When git is not available, try env vars as per Coveralls docs:
# https://docs.coveralls.io/mercurial-support
# Additionally, these variables have been extended by GIT_URL and
Expand All @@ -94,7 +94,8 @@ def git_info():
}]
if not all(head.values()):
log.warning('Failed collecting git data. Are you running '
'coveralls inside a git repository?', exc_info=ex)
'coveralls inside a git repository? Is git installed?',
exc_info=True)
return {}

return {
Expand Down

0 comments on commit 10f0558

Please sign in to comment.