summaryrefslogtreecommitdiff
path: root/Upgrade
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-12-27 15:59:59 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-12-27 15:59:59 -0400
commit60c88820987596809091ee010e6be2a083888bc8 (patch)
treedc2540c6deadfcf3efee1fd95948bcbd6f219db5 /Upgrade
parent17490f3685aee698e10555c5dc3e915a317c2250 (diff)
annex.thin
Decided it's too scary to make v6 unlocked files have 1 copy by default, but that should be available to those who need it. This is consistent with git-annex not dropping unused content without --force, etc. * Added annex.thin setting, which makes unlocked files in v6 repositories be hard linked to their content, instead of a copy. This saves disk space but means any modification of an unlocked file will lose the local (and possibly only) copy of the old version. * Enable annex.thin by default on upgrade from direct mode to v6, since direct mode made the same tradeoff. * fix: Adjusts unlocked files as configured by annex.thin.
Diffstat (limited to 'Upgrade')
-rw-r--r--Upgrade/V5.hs17
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)