summaryrefslogtreecommitdiff
path: root/Annex/Content.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-06-05 15:31:23 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-06-05 15:31:23 -0400
commitd572ad5910796510c7bd0ad494d1ba0573e998ae (patch)
treee5bb7cd3665b73c711880188219c8b8d287beffb /Annex/Content.hs
parent6aed1208802265448d98bdc4d07ea219cd4b5bb3 (diff)
wip
Diffstat (limited to 'Annex/Content.hs')
-rw-r--r--Annex/Content.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Annex/Content.hs b/Annex/Content.hs
index 9c71037de..f2d6e3249 100644
--- a/Annex/Content.hs
+++ b/Annex/Content.hs
@@ -124,7 +124,16 @@ inAnnexSafe key = inAnnex' (fromMaybe False) (Just False) go key
Nothing -> is_unlocked
check def Nothing = return def
#else
- checkindirect _ = return is_missing
+ checkindirect f = ifM (liftIO $ doesFileExist f)
+ ( do
+ v <- lockShared f
+ case v of
+ Nothing -> return is_locked
+ Just lockhandle -> do
+ dropLock lockhandle
+ return is_unlocked
+ , return is_missing
+ )
{- In Windows, see if we can take a shared lock. If so,
- remove the lock file to clean up after ourselves. -}
checkdirect contentfile lockfile =