summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-09-28 17:31:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-09-28 17:31:54 -0400
commita6989fd5f518939b781d7fffda50840289954e59 (patch)
treec9644adef23e25c4344f5f8c0a958a7d6fefede6
parentdb4db3055cfb0a58abee4ac517a8628cf108a277 (diff)
kqueue bugfix: apply pruner to changed files
It already applied the pruner when traversing directories, so .git is excluded, but .gitignore was not. Now it is.
-rw-r--r--Utility/DirWatcher.hs4
-rw-r--r--Utility/Kqueue.hs3
2 files changed, 4 insertions, 3 deletions
diff --git a/Utility/DirWatcher.hs b/Utility/DirWatcher.hs
index e4ee83191..b70e84b77 100644
--- a/Utility/DirWatcher.hs
+++ b/Utility/DirWatcher.hs
@@ -102,8 +102,8 @@ watchDir dir prune hooks runstartup = do
#if WITH_KQUEUE
type DirWatcherHandle = ThreadId
watchDir :: FilePath -> Pruner -> WatchHooks -> (IO Kqueue.Kqueue -> IO Kqueue.Kqueue) -> IO DirWatcherHandle
-watchDir dir ignored hooks runstartup = do
- kq <- runstartup $ Kqueue.initKqueue dir ignored
+watchDir dir prune hooks runstartup = do
+ kq <- runstartup $ Kqueue.initKqueue dir prune
forkIO $ Kqueue.runHooks kq hooks
#else
type DirWatcherHandle = ()
diff --git a/Utility/Kqueue.hs b/Utility/Kqueue.hs
index f44893195..4b72961b2 100644
--- a/Utility/Kqueue.hs
+++ b/Utility/Kqueue.hs
@@ -198,7 +198,8 @@ handleChange kq@(Kqueue _ _ dirmap pruner) fd olddirinfo =
go =<< catchMaybeIO (getDirInfo $ dirName olddirinfo)
where
go (Just newdirinfo) = do
- let changes = olddirinfo // newdirinfo
+ let changes = filter (not . pruner . changedFile) $
+ olddirinfo // newdirinfo
let (added, deleted) = partition isAdd changes
-- Scan newly added directories to add to the map.