From 8150faff37b4f6a55a86ea14cd181edede6a8084 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 8 Dec 2012 13:13:36 -0400 Subject: update the cache automatically when moving objects in or out --- Annex/Content.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'Annex/Content.hs') diff --git a/Annex/Content.hs b/Annex/Content.hs index 3dfb4d864..f0b9b4957 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -187,10 +187,10 @@ prepTmp key = do - and not being copied into place. -} getViaTmpUnchecked :: Key -> (FilePath -> Annex Bool) -> Annex Bool getViaTmpUnchecked key action = do - tmp <- prepTmp key - ifM (action tmp) + tmpfile <- prepTmp key + ifM (action tmpfile) ( do - moveAnnex key tmp + moveAnnex key tmpfile logStatus key InfoPresent return True , do @@ -267,6 +267,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect ) storedirect [] = storeobject =<< inRepo (gitAnnexLocation key) storedirect (dest:fs) = do + updateCache key src thawContent src liftIO $ replaceFile dest $ moveFile src liftIO $ forM_ fs $ \f -> replaceFile f $ createLink dest @@ -305,7 +306,9 @@ removeAnnex key = withObjectLoc key remove removedirect allowWrite $ parentDir file removeFile file cleanObjectLoc key - removedirect fs = mapM_ resetfile fs + removedirect fs = do + removeCache key + mapM_ resetfile fs resetfile f = do l <- calcGitLink f key top <- fromRepo Git.repoPath -- cgit v1.2.3