diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-10-05 16:23:09 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-10-05 16:23:09 -0400 |
commit | aa38d92afcc0efbe7bb9786d00c45f71af756b75 (patch) | |
tree | 8d41e4a52905d1a6141e2761aeaa5b93ffd36d71 | |
parent | 1497590d45d8f7bebc8b308e7196e493c0489f60 (diff) |
When auto-upgrading a v3 remote, avoid upgrading to version 6, instead keep it at version 5.
Fixes a bug introduced with v6 mode that I didn't notice until now.
Probably not many v3 repos left out there, and upgrading them to v6 mode
is not disastrous, only a little premature.
This commit was sponsored by Riku Voipio
-rw-r--r-- | Annex/Init.hs | 3 | ||||
-rw-r--r-- | Annex/Version.hs | 3 | ||||
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | Command/Upgrade.hs | 2 | ||||
-rw-r--r-- | Upgrade.hs | 9 | ||||
-rw-r--r-- | Upgrade/V1.hs | 6 |
6 files changed, 14 insertions, 11 deletions
diff --git a/Annex/Init.hs b/Annex/Init.hs index ead638990..9e0361daf 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -93,7 +93,8 @@ initialize' mversion = do Database.Keys.scanAssociatedFiles v <- checkAdjustedClone case v of - NeedUpgradeForAdjustedClone -> void $ upgrade True + NeedUpgradeForAdjustedClone -> + void $ upgrade True versionForAdjustedClone InAdjustedClone -> return () NotInAdjustedClone -> ifM (crippledFileSystem <&&> (not <$> isBareRepo)) diff --git a/Annex/Version.hs b/Annex/Version.hs index af9487871..7726840de 100644 --- a/Annex/Version.hs +++ b/Annex/Version.hs @@ -24,6 +24,9 @@ latestVersion = "6" supportedVersions :: [Version] supportedVersions = ["5", "6"] +versionForAdjustedClone :: Version +versionForAdjustedClone = "6" + upgradableVersions :: [Version] #ifndef mingw32_HOST_OS upgradableVersions = ["0", "1", "2", "3", "4", "5"] @@ -23,6 +23,8 @@ git-annex (6.20160924) UNRELEASED; urgency=medium were not limited to: - git commit -a of a large unlocked file (in v5 mode) - git-annex adjust when a large file was checked into git directly + * When auto-upgrading a v3 remote, avoid upgrading to version 6, + instead keep it at version 5. -- Joey Hess <id@joeyh.name> Mon, 26 Sep 2016 16:46:19 -0400 diff --git a/Command/Upgrade.hs b/Command/Upgrade.hs index 223be581d..696b794a5 100644 --- a/Command/Upgrade.hs +++ b/Command/Upgrade.hs @@ -26,5 +26,5 @@ start = do showStart "upgrade" "." whenM (isNothing <$> getVersion) $ do initialize Nothing Nothing - r <- upgrade False + r <- upgrade False latestVersion next $ next $ return r diff --git a/Upgrade.hs b/Upgrade.hs index 6d7759264..20ed7a402 100644 --- a/Upgrade.hs +++ b/Upgrade.hs @@ -26,7 +26,7 @@ checkUpgrade = maybe noop error <=< needsUpgrade needsUpgrade :: Version -> Annex (Maybe String) needsUpgrade v | v `elem` supportedVersions = ok - | v `elem` autoUpgradeableVersions = ifM (upgrade True) + | v `elem` autoUpgradeableVersions = ifM (upgrade True defaultVersion) ( ok , err "Automatic upgrade failed!" ) @@ -37,13 +37,14 @@ needsUpgrade v " is not supported. " ++ msg ok = return Nothing -upgrade :: Bool -> Annex Bool -upgrade automatic = do +upgrade :: Bool -> Version -> Annex Bool +upgrade automatic destversion = do upgraded <- go =<< getVersion when upgraded $ - setVersion latestVersion + setVersion destversion return upgraded where + go (Just v) | v >= destversion = return True #ifndef mingw32_HOST_OS go (Just "0") = Upgrade.V0.upgrade go (Just "1") = Upgrade.V1.upgrade diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs index 90e1a62a0..c82cf92f5 100644 --- a/Upgrade/V1.hs +++ b/Upgrade/V1.hs @@ -19,7 +19,6 @@ import qualified Annex.Queue import qualified Git import qualified Git.LsFiles as LsFiles import Backend -import Annex.Version import Utility.FileMode import Utility.Tmp import qualified Upgrade.V2 @@ -52,16 +51,13 @@ upgrade = do showAction "v1 to v2" ifM (fromRepo Git.repoIsLocalBare) - ( do - moveContent - setVersion latestVersion + ( moveContent , do moveContent updateSymlinks moveLocationLogs Annex.Queue.flush - setVersion latestVersion ) Upgrade.V2.upgrade |