From c79c06e6c243b787afed7817ce1967015eacaf8a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 May 2013 16:28:33 -0400 Subject: didn't quite get removeDirect right before, this passes test suite --- Annex/Direct.hs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'Annex/Direct.hs') 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 -- cgit v1.2.3