summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-03-19 21:08:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-03-19 21:08:46 -0400
commit1018c549a7e0c7442239533d0c62c83a0978f7d6 (patch)
tree045f3f24e1a6072dca86c5bc82c7d64db6dc1d5f
parent872b4a931f5333b895a46235da75cc5bab74d242 (diff)
add: display exception when lockdown fails (for RichiH)
-rw-r--r--Command/Add.hs11
1 files changed, 7 insertions, 4 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 3361a430a..0c8e2a48d 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -93,12 +93,15 @@ start file = ifAnnexed file addpresent add
- Lockdown can fail if a file gets deleted, and Nothing will be returned.
-}
lockDown :: FilePath -> Annex (Maybe KeySource)
-lockDown file = ifM crippledFileSystem
- ( liftIO $ catchMaybeIO nohardlink
- , do
+lockDown = either (\e -> showErr e >> return Nothing) (return . Just) <=< lockDown'
+
+lockDown' :: FilePath -> Annex (Either IOException KeySource)
+lockDown' file = ifM crippledFileSystem
+ ( liftIO $ tryIO nohardlink
+ , tryAnnexIO $ do
tmp <- fromRepo gitAnnexTmpMiscDir
createAnnexDirectory tmp
- eitherToMaybe <$> tryAnnexIO (go tmp)
+ go tmp
)
where
{- In indirect mode, the write bit is removed from the file as part