summaryrefslogtreecommitdiff
path: root/Upgrade
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-16 11:53:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-16 11:53:46 -0400
commit5eb76d2b033436973e0732215fa9d0227a2187bf (patch)
tree8df6807f474224d3635229f460ef7ec43fde98c6 /Upgrade
parent744638197f51811fca13a37c7bbc51dfb626793b (diff)
improve upgrade
Diffstat (limited to 'Upgrade')
-rw-r--r--Upgrade/V1.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs
index 602ba41c5..797bdee0d 100644
--- a/Upgrade/V1.hs
+++ b/Upgrade/V1.hs
@@ -21,13 +21,15 @@ import Key
import Content
import Types
import Locations
+import LocationLog
import qualified Annex
import qualified GitRepo as Git
import Backend
import Messages
import Version
import Utility
-
+import qualified Command.Init
+
-- v2 adds hashing of filenames of content and location log files.
-- Key information is encoded in filenames differently, so
-- both content and location log files move around, and symlinks
@@ -61,6 +63,12 @@ upgrade = do
Annex.queueRun
setVersion
+
+ -- add new line to auto-merge hashed location logs
+ -- this commits, so has to come after the upgrade
+ g <- Annex.gitRepo
+ liftIO $ Command.Init.gitAttributesWrite g
+
return True
moveContent :: Annex ()
@@ -110,8 +118,12 @@ moveLocationLogs = do
let f = dir </> l
liftIO $ createDirectoryIfMissing True (parentDir dest)
-- could just git mv, but this way deals with
- -- log files that are not checked into git
- liftIO $ copyFile f dest
+ -- log files that are not checked into git,
+ -- as well as merging with already upgraded
+ -- logs that have been pulled from elsewhere
+ old <- liftIO $ readLog f
+ new <- liftIO $ readLog dest
+ liftIO $ writeLog dest (old++new)
Annex.queue "add" [Param "--"] dest
Annex.queue "add" [Param "--"] f
Annex.queue "rm" [Param "--quiet", Param "-f", Param "--"] f