mirror of
https://github.com/powerline/powerline.git
synced 2025-07-28 16:24:57 +02:00
Raise an exception when git is not found
Fixes #531 as such exceptions are ignored in powerline.lib.vcs.guess.
This commit is contained in:
parent
2293657e8e
commit
c5be5c6f11
@ -9,6 +9,7 @@ from powerline.lib.shell import readlines
|
|||||||
from powerline.lib.path import join
|
from powerline.lib.path import join
|
||||||
from powerline.lib.encoding import (get_preferred_file_name_encoding,
|
from powerline.lib.encoding import (get_preferred_file_name_encoding,
|
||||||
get_preferred_file_contents_encoding)
|
get_preferred_file_contents_encoding)
|
||||||
|
from powerline.lib.shell import which
|
||||||
|
|
||||||
|
|
||||||
_ref_pat = re.compile(br'ref:\s*refs/heads/(.+)')
|
_ref_pat = re.compile(br'ref:\s*refs/heads/(.+)')
|
||||||
@ -155,6 +156,11 @@ try:
|
|||||||
return r if r != ' ' else None
|
return r if r != ' ' else None
|
||||||
except ImportError:
|
except ImportError:
|
||||||
class Repository(GitRepository):
|
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
|
@staticmethod
|
||||||
def ignore_event(path, name):
|
def ignore_event(path, name):
|
||||||
# Ignore changes to the index.lock file, since they happen
|
# Ignore changes to the index.lock file, since they happen
|
||||||
|
Loading…
x
Reference in New Issue
Block a user