Use git-annex init --version=6 to get v6 for now
Not ready to make it default because of the direct mode upgrade needing to all happen at once.
This commit is contained in:
parent
b9588fe69e
commit
7d0e79b9e1
10 changed files with 63 additions and 30 deletions
|
@ -57,8 +57,8 @@ genDescription Nothing = do
|
|||
return $ concat [hostname, ":", reldir]
|
||||
#endif
|
||||
|
||||
initialize :: Maybe String -> Annex ()
|
||||
initialize mdescription = do
|
||||
initialize :: Maybe String -> Maybe Version -> Annex ()
|
||||
initialize mdescription mversion = do
|
||||
{- Has to come before any commits are made as the shared
|
||||
- clone heuristic expects no local objects. -}
|
||||
sharedclone <- checkSharedClone
|
||||
|
@ -68,7 +68,7 @@ initialize mdescription = do
|
|||
ensureCommit $ Annex.Branch.create
|
||||
|
||||
prepUUID
|
||||
initialize'
|
||||
initialize' mversion
|
||||
|
||||
initSharedClone sharedclone
|
||||
|
||||
|
@ -77,16 +77,18 @@ initialize mdescription = do
|
|||
|
||||
-- Everything except for uuid setup, shared clone setup, and initial
|
||||
-- description.
|
||||
initialize' :: Annex ()
|
||||
initialize' = do
|
||||
initialize' :: Maybe Version -> Annex ()
|
||||
initialize' mversion = do
|
||||
checkLockSupport
|
||||
checkFifoSupport
|
||||
checkCrippledFileSystem
|
||||
unlessM isBare $
|
||||
hookWrite preCommitHook
|
||||
setDifferences
|
||||
setVersion currentVersion
|
||||
configureSmudgeFilter
|
||||
unlessM (isJust <$> getVersion) $
|
||||
setVersion (fromMaybe defaultVersion mversion)
|
||||
whenM versionSupportsUnlockedPointers
|
||||
configureSmudgeFilter
|
||||
ifM (crippledFileSystem <&&> not <$> isBare)
|
||||
( do
|
||||
enableDirectMode
|
||||
|
@ -115,7 +117,7 @@ ensureInitialized :: Annex ()
|
|||
ensureInitialized = getVersion >>= maybe needsinit checkUpgrade
|
||||
where
|
||||
needsinit = ifM Annex.Branch.hasSibling
|
||||
( initialize Nothing
|
||||
( initialize Nothing Nothing
|
||||
, error "First run: git-annex init"
|
||||
)
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ initRepo False _ dir desc mgroup = inDir dir $ do
|
|||
|
||||
initRepo' :: Maybe String -> Maybe StandardGroup -> Annex ()
|
||||
initRepo' desc mgroup = unlessM isInitialized $ do
|
||||
initialize desc
|
||||
initialize desc Nothing
|
||||
u <- getUUID
|
||||
maybe noop (defaultStandardGroup u) mgroup
|
||||
{- Ensure branch gets committed right away so it is
|
||||
|
|
|
@ -15,11 +15,14 @@ import qualified Annex
|
|||
|
||||
type Version = String
|
||||
|
||||
currentVersion :: Version
|
||||
currentVersion = "6"
|
||||
defaultVersion :: Version
|
||||
defaultVersion = "5"
|
||||
|
||||
latestVersion :: Version
|
||||
latestVersion = "6"
|
||||
|
||||
supportedVersions :: [Version]
|
||||
supportedVersions = ["5", currentVersion]
|
||||
supportedVersions = ["5", "6"]
|
||||
|
||||
upgradableVersions :: [Version]
|
||||
#ifndef mingw32_HOST_OS
|
||||
|
|
|
@ -46,7 +46,7 @@ findOrGenUUID = do
|
|||
else ifM (Annex.Branch.hasSibling <||> (isJust <$> Fields.getField Fields.autoInit))
|
||||
( do
|
||||
liftIO checkNotReadOnly
|
||||
initialize Nothing
|
||||
initialize Nothing Nothing
|
||||
getUUID
|
||||
, return NoUUID
|
||||
)
|
||||
|
|
|
@ -10,25 +10,44 @@ module Command.Init where
|
|||
import Common.Annex
|
||||
import Command
|
||||
import Annex.Init
|
||||
import Annex.Version
|
||||
import qualified Annex.SpecialRemote
|
||||
|
||||
cmd :: Command
|
||||
cmd = dontCheck repoExists $
|
||||
command "init" SectionSetup "initialize git-annex"
|
||||
paramDesc (withParams seek)
|
||||
paramDesc (seek <$$> optParser)
|
||||
|
||||
seek :: CmdParams -> CommandSeek
|
||||
seek = withWords start
|
||||
data InitOptions = InitOptions
|
||||
{ initDesc :: String
|
||||
, initVersion :: Maybe Version
|
||||
}
|
||||
|
||||
start :: [String] -> CommandStart
|
||||
start ws = do
|
||||
showStart "init" description
|
||||
next $ perform description
|
||||
where
|
||||
description = unwords ws
|
||||
optParser :: CmdParamsDesc -> Parser InitOptions
|
||||
optParser desc = InitOptions
|
||||
<$> (unwords <$> cmdParams desc)
|
||||
<*> optional (option (str >>= parseVersion)
|
||||
( long "version" <> metavar paramValue
|
||||
<> help "Override default annex.version"
|
||||
))
|
||||
|
||||
perform :: String -> CommandPerform
|
||||
perform description = do
|
||||
initialize $ if null description then Nothing else Just description
|
||||
parseVersion :: Monad m => String -> m Version
|
||||
parseVersion v
|
||||
| v `elem` supportedVersions = return v
|
||||
| otherwise = fail $ v ++ " is not a currently supported repository version"
|
||||
|
||||
seek :: InitOptions -> CommandSeek
|
||||
seek = commandAction . start
|
||||
|
||||
start :: InitOptions -> CommandStart
|
||||
start os = do
|
||||
showStart "init" (initDesc os)
|
||||
next $ perform os
|
||||
|
||||
perform :: InitOptions -> CommandPerform
|
||||
perform os = do
|
||||
initialize
|
||||
(if null (initDesc os) then Nothing else Just (initDesc os))
|
||||
(initVersion os)
|
||||
Annex.SpecialRemote.autoEnable
|
||||
next $ return True
|
||||
|
|
|
@ -38,6 +38,6 @@ perform s = do
|
|||
then return $ toUUID s
|
||||
else Remote.nameToUUID s
|
||||
storeUUID u
|
||||
initialize'
|
||||
initialize' Nothing
|
||||
Annex.SpecialRemote.autoEnable
|
||||
next $ return True
|
||||
|
|
|
@ -41,7 +41,7 @@ upgrade :: Bool -> Annex Bool
|
|||
upgrade automatic = do
|
||||
upgraded <- go =<< getVersion
|
||||
when upgraded $
|
||||
setVersion currentVersion
|
||||
setVersion latestVersion
|
||||
return upgraded
|
||||
where
|
||||
#ifndef mingw32_HOST_OS
|
||||
|
|
|
@ -54,14 +54,14 @@ upgrade = do
|
|||
ifM (fromRepo Git.repoIsLocalBare)
|
||||
( do
|
||||
moveContent
|
||||
setVersion currentVersion
|
||||
setVersion latestVersion
|
||||
, do
|
||||
moveContent
|
||||
updateSymlinks
|
||||
moveLocationLogs
|
||||
|
||||
Annex.Queue.flush
|
||||
setVersion currentVersion
|
||||
setVersion latestVersion
|
||||
)
|
||||
|
||||
Upgrade.V2.upgrade
|
||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -1,6 +1,6 @@
|
|||
git-annex (6.20151225) unstable; urgency=medium
|
||||
|
||||
* annex.version increased to 6, but version 5 is also still supported.
|
||||
* Added v6 repository mode, but v5 is still the default for now.
|
||||
* The upgrade to version 6 is not done fully automatically, because
|
||||
upgrading a direct mode repository to version 6 will prevent old
|
||||
versions of git-annex from working in other clones of that repository.
|
||||
|
@ -12,6 +12,8 @@ git-annex (6.20151225) unstable; urgency=medium
|
|||
* unlock, lock: In v6 mode, unlocking a file changes it from a symlink to a
|
||||
pointer file, and this change can be committed to the git repository.
|
||||
* add: In v6 mode, adds modified files to the annex.
|
||||
* init: --version parameter added to control which supported repository
|
||||
version to use.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Tue, 08 Dec 2015 11:14:03 -0400
|
||||
|
||||
|
|
|
@ -24,6 +24,13 @@ mark it as dead (see [[git-annex-dead]](1)).
|
|||
This command is entirely safe, although usually pointless, to run inside an
|
||||
already initialized git-annex repository.
|
||||
|
||||
# OPTIONS
|
||||
|
||||
* `--version=N`
|
||||
|
||||
Force the repository to be initialized using a different annex.version
|
||||
than the current default.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
[[git-annex]](1)
|
||||
|
|
Loading…
Add table
Reference in a new issue