Merge pull request #1089 from ZyX-I/fix-531

Raise an exception when git is not found
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2014-09-20 14:48:59 +04:00
commit 32cc0c7711
2 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,7 @@ from powerline.lib.shell import readlines
from powerline.lib.path import join
from powerline.lib.encoding import (get_preferred_file_name_encoding,
get_preferred_file_contents_encoding)
from powerline.lib.shell import which
_ref_pat = re.compile(br'ref:\s*refs/heads/(.+)')
@ -155,6 +156,11 @@ try:
return r if r != ' ' else None
except ImportError:
class Repository(GitRepository):
def __init__(self, *args, **kwargs):
if not which('git'):
raise OSError('git executable is not available')
super(Repository, self).__init__(*args, **kwargs)
@staticmethod
def ignore_event(path, name):
# Ignore changes to the index.lock file, since they happen

View File

@ -183,6 +183,7 @@ mkdir tests/shell/path
ln -s "$(which "${PYTHON}")" tests/shell/path/python
ln -s "$(which screen)" tests/shell/path
ln -s "$(which env)" tests/shell/path
ln -s "$(which git)" tests/shell/path
ln -s "$(which sleep)" tests/shell/path
ln -s "$(which cat)" tests/shell/path
ln -s "$(which false)" tests/shell/path