Skip to content

Commit

Permalink
feat(git): Omit git info when git isnt installed (#187)
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 authored and TheKevJames committed Sep 28, 2018
1 parent 2abfcb9 commit 764956e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions coveralls/git.py
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) as ex:
# 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=ex)
return {}

return {
Expand Down

0 comments on commit 764956e

Please sign in to comment.