From d572ad5910796510c7bd0ad494d1ba0573e998ae Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Jun 2014 15:31:23 -0400 Subject: wip --- Annex/Content.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Annex/Content.hs') 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 = -- cgit v1.2.3