default annex.delayadd to 1 on OSX
This commit is contained in:
parent
0b2b67e809
commit
2840105ec4
4 changed files with 26 additions and 3 deletions
|
@ -5,6 +5,8 @@
|
||||||
- Licensed under the GNU GPL version 3 or higher.
|
- Licensed under the GNU GPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module Assistant.Threads.Watcher (
|
module Assistant.Threads.Watcher (
|
||||||
watchThread,
|
watchThread,
|
||||||
checkCanWatch,
|
checkCanWatch,
|
||||||
|
@ -58,17 +60,28 @@ needLsof = error $ unlines
|
||||||
, "Be warned: This can corrupt data in the annex, and make fsck complain."
|
, "Be warned: This can corrupt data in the annex, and make fsck complain."
|
||||||
]
|
]
|
||||||
|
|
||||||
|
{- 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
|
||||||
|
#ifdef darwin_HOST_OS
|
||||||
|
delayaddDefault = Just $ Seconds 1
|
||||||
|
#else
|
||||||
|
delayaddDefault = Nothing
|
||||||
|
#endif
|
||||||
|
|
||||||
watchThread :: ThreadState -> DaemonStatusHandle -> TransferQueue -> ChangeChan -> NamedThread
|
watchThread :: ThreadState -> DaemonStatusHandle -> TransferQueue -> ChangeChan -> NamedThread
|
||||||
watchThread st dstatus transferqueue changechan = NamedThread thisThread $ do
|
watchThread st dstatus transferqueue changechan = NamedThread thisThread $ do
|
||||||
delayadd <- runThreadState st $
|
delayadd <- runThreadState st $
|
||||||
readish <$> getConfig (annexConfig "delayadd") ""
|
maybe delayaddDefault (Just . Seconds) . readish
|
||||||
|
<$> getConfig (annexConfig "delayadd") ""
|
||||||
void $ watchDir "." ignored (hooks delayadd) startup
|
void $ watchDir "." ignored (hooks delayadd) startup
|
||||||
debug thisThread [ "watching", "."]
|
debug thisThread [ "watching", "."]
|
||||||
where
|
where
|
||||||
startup = startupScan st dstatus
|
startup = startupScan st dstatus
|
||||||
hook delay a = Just $ runHandler thisThread delay st dstatus transferqueue changechan a
|
hook delay a = Just $ runHandler thisThread delay st dstatus transferqueue changechan a
|
||||||
hooks delayadd = mkWatchHooks
|
hooks delayadd = mkWatchHooks
|
||||||
{ addHook = hook (Seconds <$> delayadd) onAdd
|
{ addHook = hook delayadd onAdd
|
||||||
, delHook = hook Nothing onDel
|
, delHook = hook Nothing onDel
|
||||||
, addSymlinkHook = hook Nothing onAddSymlink
|
, addSymlinkHook = hook Nothing onAddSymlink
|
||||||
, delDirHook = hook Nothing onDelDir
|
, delDirHook = hook Nothing onDelDir
|
||||||
|
|
|
@ -14,3 +14,5 @@ OSX - 10.6. zsh. git-annex version: 3.20120826
|
||||||
|
|
||||||
Please provide any additional information below.
|
Please provide any additional information below.
|
||||||
|
|
||||||
|
> Ok, I've put in the one second delay to adding by default on OSX.
|
||||||
|
> I consider this bug [[done]], at least for now..
|
||||||
|
|
|
@ -4,3 +4,10 @@ Misc OSX porting things:
|
||||||
* add webapp to OSX menu somehow
|
* add webapp to OSX menu somehow
|
||||||
* Use OSX's "network reachability functionality" to detect when on a network
|
* Use OSX's "network reachability functionality" to detect when on a network
|
||||||
<http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/SystemConfigFrameworks/SC_Intro/SC_Intro.html#//apple_ref/doc/uid/TP40001065>
|
<http://developer.apple.com/library/mac/#documentation/Networking/Conceptual/SystemConfigFrameworks/SC_Intro/SC_Intro.html#//apple_ref/doc/uid/TP40001065>
|
||||||
|
|
||||||
|
Gripes:
|
||||||
|
|
||||||
|
* The assistant has to wait a second when a new file is created,
|
||||||
|
to work around some bad behavior when pasting a file into the annex.
|
||||||
|
[[details|bugs/pasting_into_annex_on_OSX]]. That's one more second
|
||||||
|
before the file is synced out.
|
||||||
|
|
|
@ -684,7 +684,8 @@ Here are all the supported configuration settings.
|
||||||
Makes the watch and assistant commands delay for the specified number of
|
Makes the watch and assistant commands delay for the specified number of
|
||||||
seconds before adding a newly created file to the annex. Normally this
|
seconds before adding a newly created file to the annex. Normally this
|
||||||
is not needed, because they already wait for all writers of the file
|
is not needed, because they already wait for all writers of the file
|
||||||
to close it.
|
to close it. On Mac OSX, this defaults to 1 second, to work around
|
||||||
|
a bad interaction with software there.
|
||||||
|
|
||||||
* `remote.<name>.annex-cost`
|
* `remote.<name>.annex-cost`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue