From 5e90916fe9da394dc5d8795273249f861c5bbf6a Mon Sep 17 00:00:00 2001
From: Daira Hopwood <daira@jacaranda.org>
Date: Fri, 30 Oct 2015 02:04:30 +0000
Subject: [PATCH] Don't add subdirectory watches if the platform's notifier
 doesn't require them. refs #2559

Signed-off-by: Daira Hopwood <daira@jacaranda.org>
---
 src/allmydata/frontends/magic_folder.py | 4 +++-
 src/allmydata/windows/inotify.py        | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py
index b216294b..62daae8c 100644
--- a/src/allmydata/frontends/magic_folder.py
+++ b/src/allmydata/frontends/magic_folder.py
@@ -351,7 +351,9 @@ class Uploader(QueueMixin):
                 self.warn("WARNING: cannot upload symlink %s" % quote_filepath(fp))
                 return None
             elif pathinfo.isdir:
-                self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True)
+                if not getattr(self._notifier, 'recursive_includes_new_subdirectories', False):
+                    self._notifier.watch(fp, mask=self.mask, callbacks=[self._notify], recursive=True)
+
                 uploadable = Data("", self._client.convergence)
                 encoded_path_u += magicpath.path2magic(u"/")
                 upload_d = self._upload_dirnode.add_file(encoded_path_u, uploadable, metadata={"version":0}, overwrite=True)
diff --git a/src/allmydata/windows/inotify.py b/src/allmydata/windows/inotify.py
index bcbc241f..4e7bc904 100644
--- a/src/allmydata/windows/inotify.py
+++ b/src/allmydata/windows/inotify.py
@@ -201,6 +201,7 @@ class INotify(PollMixin):
         self._path = None
         self._pending = set()
         self._pending_delay = 1.0
+        self.recursive_includes_new_subdirectories = True
 
     def set_pending_delay(self, delay):
         self._pending_delay = delay
-- 
2.45.2