mirror of
https://github.com/powerline/powerline.git
synced 2025-07-17 02:44:52 +02:00
Merge pull request #898 from ZyX-I/fix-inotify-watcher
Fix inotify tree watcher bug Fixes #874
This commit is contained in:
commit
c6d5632779
@ -119,7 +119,8 @@ class INotifyTreeWatcher(INotify):
|
|||||||
return
|
return
|
||||||
path = self.watched_rmap.get(wd, None)
|
path = self.watched_rmap.get(wd, None)
|
||||||
if path is not 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:
|
if mask & self.CREATE:
|
||||||
# A new sub-directory might have been created, monitor it.
|
# A new sub-directory might have been created, monitor it.
|
||||||
try:
|
try:
|
||||||
|
@ -57,22 +57,18 @@ def do_status(directory, path, func):
|
|||||||
return func(directory, path)
|
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:
|
try:
|
||||||
import pygit2 as git
|
import pygit2 as git
|
||||||
|
|
||||||
class Repository(object):
|
class Repository(object):
|
||||||
__slots__ = ('directory', 'ignore_event')
|
__slots__ = ('directory',)
|
||||||
|
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
self.directory = os.path.abspath(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):
|
def do_status(self, directory, path):
|
||||||
if path:
|
if path:
|
||||||
@ -146,11 +142,17 @@ try:
|
|||||||
return get_branch_name(self.directory)
|
return get_branch_name(self.directory)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
class Repository(object):
|
class Repository(object):
|
||||||
__slots__ = ('directory', 'ignore_event')
|
__slots__ = ('directory',)
|
||||||
|
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
self.directory = os.path.abspath(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):
|
def _gitcmd(self, directory, *args):
|
||||||
return readlines(('git',) + args, directory)
|
return readlines(('git',) + args, directory)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user