diff options
Diffstat (limited to 'Annex/Direct.hs')
-rw-r--r-- | Annex/Direct.hs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 6d9f3e31d..962c7595c 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -203,13 +203,16 @@ toDirectGen k f = do liftIO . void . copyFileExternal loc _ -> return Nothing -{- Removes a direct mode file, while retaining its content in the annex. -} +{- Removes a direct mode file, while retaining its content in the annex + - (unless its content has already been changed). -} removeDirect :: Key -> FilePath -> Annex () removeDirect k f = do - otherlocs <- removeAssociatedFile k f - unless (null otherlocs) $ - unlessM (inAnnex k) $ - moveAnnex k f + void $ removeAssociatedFileUnchecked k f + unlessM (inAnnex k) $ + ifM (goodContent k f) + ( moveAnnex k f + , logStatus k InfoMissing + ) liftIO $ do nukeFile f void $ tryIO $ removeDirectory $ parentDir f |