aboutsummaryrefslogtreecommitdiff
path: root/Assistant
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-28 16:42:11 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-28 16:42:11 -0400
commit5c9891e1d139fb750ae5efe1ed2c8e5b2044287f (patch)
treea6c7d608f4e76059cf9ddcabfffd50c03d8a09cf /Assistant
parent92f57da495b25b4d42ed8e2efa3fc09c89b460b0 (diff)
OSX assistant: Uses direct mode by default when setting up a new local repository.
Diffstat (limited to 'Assistant')
-rw-r--r--Assistant/Threads/Committer.hs20
1 files changed, 12 insertions, 8 deletions
diff --git a/Assistant/Threads/Committer.hs b/Assistant/Threads/Committer.hs
index 4d623eb0a..e968959c6 100644
--- a/Assistant/Threads/Committer.hs
+++ b/Assistant/Threads/Committer.hs
@@ -41,9 +41,9 @@ import Data.Either
{- This thread makes git commits at appropriate times. -}
commitThread :: NamedThread
commitThread = NamedThread "Committer" $ do
- delayadd <- liftAnnex $
- maybe delayaddDefault (Just . Seconds) . readish
- <$> getConfig (annexConfig "delayadd") ""
+ delayadd <- liftAnnex $ do
+ v <- readish <$> getConfig (annexConfig "delayadd") ""
+ maybe delayaddDefault (return . Just . Seconds) v
runEvery (Seconds 1) <~> do
-- We already waited one second as a simple rate limiter.
-- Next, wait until at least one change is available for
@@ -115,13 +115,17 @@ shouldCommit now changes
thisSecond c = now `diffUTCTime` changeTime c <= 1
{- OSX needs a short delay after a file is added before locking it down,
- - as pasting a file seems to try to set file permissions or otherwise
- - access the file after closing it. -}
-delayaddDefault :: Maybe Seconds
+ - when using a non-direct mode repository, as pasting a file seems to
+ - try to set file permissions or otherwise access the file after closing
+ - it. -}
+delayaddDefault :: Annex (Maybe Seconds)
#ifdef darwin_HOST_OS
-delayaddDefault = Just $ Seconds 1
+delayaddDefault = ifM isDirect
+ ( return Nothing
+ , return $ Just $ Seconds 1
+ )
#else
-delayaddDefault = Nothing
+delayaddDefault = return Nothing
#endif
{- If there are PendingAddChanges, or InProcessAddChanges, the files