summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
Diffstat (limited to 'Annex')
-rw-r--r--Annex/ChangedRefs.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/Annex/ChangedRefs.hs b/Annex/ChangedRefs.hs
index 0dc82d3b3..1f2372c04 100644
--- a/Annex/ChangedRefs.hs
+++ b/Annex/ChangedRefs.hs
@@ -71,7 +71,7 @@ stopWatchingChangedRefs h@(ChangedRefsHandle wh chan) = do
atomically $ closeTBMChan chan
drainChangedRefs h
-watchChangedRefs :: Annex ChangedRefsHandle
+watchChangedRefs :: Annex (Maybe ChangedRefsHandle)
watchChangedRefs = do
-- This channel is used to accumulate notifications,
-- because the DirWatcher might have multiple threads that find
@@ -90,8 +90,11 @@ watchChangedRefs = do
, modifyHook = notifyhook
}
- h <- liftIO $ watchDir refdir (const False) True hooks id
- return $ ChangedRefsHandle h chan
+ if canWatch
+ then do
+ h <- liftIO $ watchDir refdir (const False) True hooks id
+ return $ Just $ ChangedRefsHandle h chan
+ else return Nothing
notifyHook :: TBMChan Git.Sha -> FilePath -> Maybe FileStatus -> IO ()
notifyHook chan reffile _