diff --git a/powerline/lib/tree_watcher.py b/powerline/lib/tree_watcher.py index 608e2946..c0ff4c3c 100644 --- a/powerline/lib/tree_watcher.py +++ b/powerline/lib/tree_watcher.py @@ -119,7 +119,8 @@ class INotifyTreeWatcher(INotify): return path = self.watched_rmap.get(wd, None) if path is not None: - self.modified = not self.ignore_event(path, name) + if not self.ignore_event(path, name): + self.modified = True if mask & self.CREATE: # A new sub-directory might have been created, monitor it. try: diff --git a/powerline/lib/vcs/git.py b/powerline/lib/vcs/git.py index e9e16b8b..5339ca4e 100644 --- a/powerline/lib/vcs/git.py +++ b/powerline/lib/vcs/git.py @@ -57,22 +57,18 @@ def do_status(directory, path, func): return func(directory, path) -def ignore_event(path, name): - # Ignore changes to the index.lock file, since they happen frequently and - # dont indicate an actual change in the working tree status - return False - return path.endswith('.git') and name == 'index.lock' - - try: import pygit2 as git class Repository(object): - __slots__ = ('directory', 'ignore_event') + __slots__ = ('directory',) def __init__(self, directory): self.directory = os.path.abspath(directory) - self.ignore_event = ignore_event + + @staticmethod + def ignore_event(path, name): + return False def do_status(self, directory, path): if path: @@ -146,11 +142,17 @@ try: return get_branch_name(self.directory) except ImportError: class Repository(object): - __slots__ = ('directory', 'ignore_event') + __slots__ = ('directory',) def __init__(self, directory): self.directory = os.path.abspath(directory) - self.ignore_event = ignore_event + + @staticmethod + def ignore_event(path, name): + # Ignore changes to the index.lock file, since they happen + # frequently and dont indicate an actual change in the working tree + # status + return path.endswith('.git') and name == 'index.lock' def _gitcmd(self, directory, *args): return readlines(('git',) + args, directory)