diff options
-rw-r--r-- | Assistant/Threads/Watcher.hs | 5 | ||||
-rw-r--r-- | Utility/FSEvents.hs | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/Assistant/Threads/Watcher.hs b/Assistant/Threads/Watcher.hs index a69ab6a09..1c5d7206b 100644 --- a/Assistant/Threads/Watcher.hs +++ b/Assistant/Threads/Watcher.hs @@ -69,7 +69,6 @@ watchThread = NamedThread "Watcher" $ do errhook <- hook onErr let hooks = mkWatchHooks { addHook = addhook - , modifyHook = addhook , delHook = delhook , addSymlinkHook = addsymlinkhook , delDirHook = deldirhook @@ -143,10 +142,10 @@ onAddDirect file fs = do case (v, fs) of (Just key, Just filestatus) -> ifM (liftAnnex $ changedFileStatus key filestatus) - ( noChange - , do + ( do liftAnnex $ changedDirect key file pendingAddChange file + , noChange ) _ -> pendingAddChange file diff --git a/Utility/FSEvents.hs b/Utility/FSEvents.hs index 97431c159..af8c2fc2f 100644 --- a/Utility/FSEvents.hs +++ b/Utility/FSEvents.hs @@ -50,8 +50,13 @@ watchDir dir ignored hooks = do ) else maybe (runhook delHook Nothing) handleadd =<< getstatus (eventPath evt) + {- Add hooks are run when a file is modified for + - compatability with INotify, which calls the add + - hook when a file is closed, and so tends to call + - both add and modify for file modifications. -} when (hasflag eventFlagItemModified && not (hasflag eventFlagItemIsDir)) $ do ms <- getstatus $ eventPath evt + maybe noop handleadd ms runhook modifyHook ms where hasflag f = eventFlags evt .&. f /= 0 |