summaryrefslogtreecommitdiff
path: root/Remote/Directory.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-09 18:33:15 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-09 18:33:15 -0400
commitd3e1a3619ff6939367f43cbd46131b7f60ef6bd0 (patch)
treebc7e29364f11d3369730b0b61ad58e942b95d1cf /Remote/Directory.hs
parent2934a65ac5bbab5ac127c495c8c2492e729c2b67 (diff)
safer inannex checking
git-annex-shell inannex now returns always 0, 1, or 100 (the last when it's unclear if content is currently in the index due to it currently being moved or dropped). (Actual locking code still not yet written.)
Diffstat (limited to 'Remote/Directory.hs')
-rw-r--r--Remote/Directory.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 8e306e228..6d3a5da7d 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -114,5 +114,9 @@ remove d k = liftIO $ catchBool $ do
file = dirKey d k
dir = parentDir file
-checkPresent :: FilePath -> Key -> Annex (Either IOException Bool)
-checkPresent d k = liftIO $ try $ doesFileExist (dirKey d k)
+checkPresent :: FilePath -> Key -> Annex (Either String Bool)
+checkPresent d k = dispatch <$> check
+ where
+ check = liftIO $ try $ doesFileExist (dirKey d k)
+ dispatch (Left e) = Left $ show e
+ dispatch (Right v) = Right v