From 95f30f07830ddefc27a9cccb3dac97898e47e78b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 30 Apr 2013 19:33:43 -0400 Subject: thaw content directory in direct mode too A content directory can be frozen in direct mode. One way this can happen is if the content is transferred before direct mode has a mapping for it, so it's stored in the content directory. So, we need to thaw the content directory before doing things with it. --- Annex/Content.hs | 2 ++ Annex/Direct.hs | 2 ++ Command/Indirect.hs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Annex/Content.hs b/Annex/Content.hs index 6e040b9ac..6f2c9690e 100644 --- a/Annex/Content.hs +++ b/Annex/Content.hs @@ -242,6 +242,7 @@ moveAnnex key src = withObjectLoc key storeobject storedirect storedirect' [] = storeobject =<< calcRepo (gitAnnexLocation key) storedirect' (dest:fs) = do + thawContentDir =<< calcRepo (gitAnnexLocation key) updateInodeCache key src thawContent src replaceFile dest $ liftIO . moveFile src @@ -358,6 +359,7 @@ removeAnnex key = withObjectLoc key remove removedirect removeInodeCache key cleanObjectLoc key removedirect fs = do + thawContentDir =<< calcRepo (gitAnnexLocation key) cache <- recordedInodeCache key removeInodeCache key mapM_ (resetfile cache) fs diff --git a/Annex/Direct.hs b/Annex/Direct.hs index 68da12a22..f8bdaebb3 100644 --- a/Annex/Direct.hs +++ b/Annex/Direct.hs @@ -25,6 +25,7 @@ import Annex.Content.Direct import Annex.Link import Utility.InodeCache import Utility.CopyFile +import Annex.Perms {- Uses git ls-files to find files that need to be committed, and stages - them into the index. Returns True if some changes were staged. -} @@ -187,6 +188,7 @@ toDirectGen k f = do [] -> ifM (liftIO $ doesFileExist loc) ( return $ Just $ do {- Move content from annex to direct file. -} + thawContentDir loc updateInodeCache k loc thawContent loc replaceFile f $ liftIO . moveFile loc diff --git a/Command/Indirect.hs b/Command/Indirect.hs index 59972a66b..668bebefb 100644 --- a/Command/Indirect.hs +++ b/Command/Indirect.hs @@ -18,6 +18,7 @@ import Annex.Direct import Annex.Content import Annex.CatFile import Annex.Version +import Annex.Perms import Init def :: [Command] @@ -80,6 +81,7 @@ perform = do fromdirect f k = do showStart "indirect" f + thawContentDir =<< calcRepo (gitAnnexLocation k) cleandirect k -- clean before content directory gets frozen whenM (liftIO $ not . isSymbolicLink <$> getSymbolicLinkStatus f) $ do moveAnnex k f -- cgit v1.2.3