annex.version is now set to 4 for direct mode repositories

To avoid old versions of git-annex getting confused.

There is no upgrade required though.
We switch back to 3 when going from direct to indirect.
This commit is contained in:
Joey Hess 2013-02-26 15:13:10 -04:00
parent 9052efbc22
commit 2d9c046dea
8 changed files with 23 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{- git-annex repository versioning
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
- Copyright 2010,2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@ -16,8 +16,11 @@ type Version = String
defaultVersion :: Version
defaultVersion = "3"
directModeVersion :: Version
directModeVersion = "4"
supportedVersions :: [Version]
supportedVersions = [defaultVersion]
supportedVersions = [defaultVersion, directModeVersion]
upgradableVersions :: [Version]
upgradableVersions = ["0", "1", "2"]
@ -28,8 +31,8 @@ versionField = annexConfig "version"
getVersion :: Annex (Maybe Version)
getVersion = annexVersion <$> Annex.getGitConfig
setVersion :: Annex ()
setVersion = setConfig versionField defaultVersion
setVersion :: Version -> Annex ()
setVersion = setConfig versionField
removeVersion :: Annex ()
removeVersion = unsetConfig versionField

View file

@ -14,6 +14,7 @@ import qualified Git.Command
import qualified Git.LsFiles
import Config
import Annex.Direct
import Annex.Version
def :: [Command]
def = [notBareRepo $
@ -53,4 +54,5 @@ cleanup :: CommandCleanup
cleanup = do
showStart "direct" ""
setDirect True
setVersion directModeVersion
return True

View file

@ -17,6 +17,7 @@ import qualified Annex
import Annex.Direct
import Annex.Content
import Annex.CatFile
import Annex.Version
import Init
def :: [Command]
@ -88,6 +89,7 @@ perform = do
cleanup :: CommandCleanup
cleanup = do
setVersion defaultVersion
showStart "indirect" ""
showEndOk
return True

View file

@ -23,5 +23,5 @@ start :: CommandStart
start = do
showStart "upgrade" "."
r <- upgrade
setVersion
setVersion defaultVersion
next $ next $ return r

View file

@ -42,9 +42,9 @@ genDescription Nothing = do
initialize :: Maybe String -> Annex ()
initialize mdescription = do
prepUUID
setVersion defaultVersion
checkCrippledFileSystem
Annex.Branch.create
setVersion
gitPreCommitHookWrite
createInodeSentinalFile
u <- getUUID
@ -143,3 +143,4 @@ checkCrippledFileSystem = whenM (probeCrippledFileSystem) $ do
maybe noop (`toDirect` f) =<< isAnnexLink f
void $ liftIO clean
setDirect True
setVersion directModeVersion

View file

@ -53,14 +53,14 @@ upgrade = do
ifM (fromRepo Git.repoIsLocalBare)
( do
moveContent
setVersion
setVersion defaultVersion
, do
moveContent
updateSymlinks
moveLocationLogs
Annex.Queue.flush
setVersion
setVersion defaultVersion
)
Upgrade.V2.upgrade

3
debian/changelog vendored
View file

@ -1,5 +1,6 @@
git-annex (3.20130217) UNRELEASED; urgency=low
git-annex (4.20130217) UNRELEASED; urgency=low
* annex.version is now set to 4 for direct mode repositories.
* Should now fully support git repositories with core.symlinks=false;
always using git's pseudosymlink files in such repositories.
* webapp: Allow creating repositories on filesystems that lack support for

View file

@ -18,6 +18,11 @@ conflicts first before upgrading git-annex.
## Upgrade events, so far
### v3 -> v4 (git-annex version 4.x)
v4 is only used for [[direct_mode]], and no upgrade needs to be done from
existing v3 repositories, they will continue to work.
### v2 -> v3 (git-annex version 3.x)
Involved moving the .git-annex/ directory into a separate git-annex branch.