summaryrefslogtreecommitdiff
path: root/Utility/DirWatcher/INotify.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-05 17:44:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-05 17:44:14 -0400
commit1db1469905cd08da2b4a2f5e310437ff5233f286 (patch)
treedce09d0ef76f95819bfb8f3d2640c4121475c5fe /Utility/DirWatcher/INotify.hs
parentf86866c6130ad7b8eb1433c976e4c94b1f17e30d (diff)
annex.startupscan can be set to false to disable the assistant's startup scan.
Diffstat (limited to 'Utility/DirWatcher/INotify.hs')
-rw-r--r--Utility/DirWatcher/INotify.hs12
1 files changed, 7 insertions, 5 deletions
diff --git a/Utility/DirWatcher/INotify.hs b/Utility/DirWatcher/INotify.hs
index 922f202a4..016858b1b 100644
--- a/Utility/DirWatcher/INotify.hs
+++ b/Utility/DirWatcher/INotify.hs
@@ -46,8 +46,8 @@ import Control.Exception (throw)
- So this will fail if there are too many subdirectories. The
- errHook is called when this happens.
-}
-watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> WatchHooks -> IO ()
-watchDir i dir ignored hooks
+watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> Bool -> WatchHooks -> IO ()
+watchDir i dir ignored scanevents hooks
| ignored dir = noop
| otherwise = do
-- Use a lock to make sure events generated during initial
@@ -61,7 +61,7 @@ watchDir i dir ignored hooks
mapM_ scan =<< filter (not . dirCruft) <$>
getDirectoryContents dir
where
- recurse d = watchDir i d ignored hooks
+ recurse d = watchDir i d ignored scanevents hooks
-- Select only inotify events required by the enabled
-- hooks, but always include Create so new directories can
@@ -85,9 +85,11 @@ watchDir i dir ignored hooks
| Files.isDirectory s ->
recurse $ indir f
| Files.isSymbolicLink s ->
- runhook addSymlinkHook f ms
+ when scanevents $
+ runhook addSymlinkHook f ms
| Files.isRegularFile s ->
- runhook addHook f ms
+ when scanevents $
+ runhook addHook f ms
| otherwise ->
noop