diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-19 21:08:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-19 21:08:46 -0400 |
commit | 9aa31b71f37d95341e5084d4623b0ff0c60ef731 (patch) | |
tree | e95d2057509e662ea0396045d129509c1817e3e9 /Command/Add.hs | |
parent | 060dfe4faa6b87187d2e9b0fb605a99d5dd8ce9c (diff) |
add: display exception when lockdown fails (for RichiH)
Diffstat (limited to 'Command/Add.hs')
-rw-r--r-- | Command/Add.hs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Command/Add.hs b/Command/Add.hs index 3361a430aa..0c8e2a48d4 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 |