diff options
Diffstat (limited to 'Upgrade/V5.hs')
-rw-r--r-- | Upgrade/V5.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Upgrade/V5.hs b/Upgrade/V5.hs index f6d18df43..69518f63b 100644 --- a/Upgrade/V5.hs +++ b/Upgrade/V5.hs @@ -8,18 +8,20 @@ module Upgrade.V5 where import Common.Annex +import qualified Annex import Config import Annex.InodeSentinal import Annex.Link import Annex.Direct import Annex.Content -import Annex.WorkTree +import Annex.CatFile import qualified Database.Keys import qualified Annex.Content.Direct as Direct import qualified Git import qualified Git.LsFiles import qualified Git.Branch import Git.FileMode +import Git.Config import Utility.InodeCache upgrade :: Bool -> Annex Bool @@ -27,6 +29,11 @@ upgrade automatic = do unless automatic $ showAction "v5 to v6" whenM isDirect $ do + {- Direct mode makes the same tradeoff of using less disk + - space, with less preservation of old versions of files + - as does annex.thin. -} + setConfig (annexConfig "thin") (boolConfig True) + Annex.changeGitConfig $ \c -> c { annexThin = True } {- Since upgrade from direct mode changes how files - are represented in git, commit any changes in the - work tree first. -} @@ -70,7 +77,9 @@ upgradeDirectWorkTree = do void $ liftIO clean where go (f, Just _sha, Just mode) | isSymLink mode = do - mk <- lookupFile f + -- Cannot use lookupFile here, as we're in between direct + -- mode and v6. + mk <- catKeyFile f case mk of Nothing -> noop Just k -> do @@ -84,13 +93,13 @@ upgradeDirectWorkTree = do go _ = noop fromdirect f k = do - -- If linkAnnex fails for some reason, the work tree file + -- If linkToAnnex fails for some reason, the work tree file -- still has the content; the annex object file is just -- not populated with it. Since the work tree file -- is recorded as an associated file, things will still -- work that way, it's just not ideal. ic <- withTSDelta (liftIO . genInodeCache f) - void $ linkAnnex k f ic + void $ linkToAnnex k f ic writepointer f k = liftIO $ do nukeFile f writeFile f (formatPointer k) |