honor init --version=5 on crippled filesystem

init: When --version=5 is passed on a crippled filesystem, use a v5 direct
mode repo as requested, rather than upgrading to v7 adjusted unlocked.

Fixed test suite on crippled filesystems, making it request --version=5
to test direct mode.
This commit is contained in:
Joey Hess 2018-12-19 13:07:19 -04:00
parent 14971414dc
commit 5759e93444
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 15 additions and 13 deletions

View file

@ -109,7 +109,10 @@ initialize' ai mversion = checkCanInitialize ai $ do
hookWrite postReceiveHook hookWrite postReceiveHook
setDifferences setDifferences
unlessM (isJust <$> getVersion) $ unlessM (isJust <$> getVersion) $
setVersion (fromMaybe defaultVersion mversion) ifM (crippledFileSystem <&&> (not <$> isBareRepo))
( setVersion (fromMaybe versionForCrippledFilesystem mversion)
, setVersion (fromMaybe defaultVersion mversion)
)
whenM versionSupportsUnlockedPointers $ do whenM versionSupportsUnlockedPointers $ do
configureSmudgeFilter configureSmudgeFilter
scanUnlockedFiles scanUnlockedFiles
@ -286,11 +289,12 @@ propigateSecureHashesOnly =
=<< getGlobalConfig "annex.securehashesonly" =<< getGlobalConfig "annex.securehashesonly"
adjustToCrippledFilesystem :: Annex () adjustToCrippledFilesystem :: Annex ()
adjustToCrippledFilesystem = ifM (liftIO $ AdjustedBranch.isGitVersionSupported) adjustToCrippledFilesystem = ifM versionSupportsAdjustedBranch
( do ( ifM (liftIO $ AdjustedBranch.isGitVersionSupported)
void $ upgrade True versionForCrippledFilesystem ( AdjustedBranch.adjustToCrippledFileSystem
AdjustedBranch.adjustToCrippledFileSystem , enableDirectMode
, enableDirectMode )
, enableDirectMode
) )
enableDirectMode :: Annex () enableDirectMode :: Annex ()

View file

@ -5,6 +5,9 @@ git-annex (7.20181212) UNRELEASED; urgency=medium
exporttree remote that is not untrusted (currently only S3 remotes exporttree remote that is not untrusted (currently only S3 remotes
with versioning). with versioning).
* Make test suite work better when the temp directory is on NFS. * Make test suite work better when the temp directory is on NFS.
* init: When --version=5 is passed on a crippled filesystem,
use a v5 direct mode repo as requested, rather than upgrading to v7
adjusted unlocked. (Fixes test suite on crippled filesystems.)
-- Joey Hess <id@joeyh.name> Tue, 18 Dec 2018 12:24:52 -0400 -- Joey Hess <id@joeyh.name> Tue, 18 Dec 2018 12:24:52 -0400

View file

@ -276,9 +276,7 @@ unitTests note = testGroup ("Unit Tests " ++ note)
test_init :: Assertion test_init :: Assertion
test_init = innewrepo $ do test_init = innewrepo $ do
ver <- annexVersion <$> getTestMode ver <- annexVersion <$> getTestMode
if ver == Annex.Version.defaultVersion git_annex "init" [reponame, "--version", show (fromRepoVersion ver)] @? "init failed"
then git_annex "init" [reponame] @? "init failed"
else git_annex "init" [reponame, "--version", show (fromRepoVersion ver)] @? "init failed"
setupTestMode setupTestMode
where where
reponame = "test repo" reponame = "test repo"

View file

@ -17,7 +17,6 @@ import Types.Test
import qualified Annex import qualified Annex
import qualified Annex.UUID import qualified Annex.UUID
import qualified Annex.Version
import qualified Types.RepoVersion import qualified Types.RepoVersion
import qualified Backend import qualified Backend
import qualified Git.CurrentRepo import qualified Git.CurrentRepo
@ -214,9 +213,7 @@ clonerepo old new cfg = do
configrepo new configrepo new
indir new $ do indir new $ do
ver <- annexVersion <$> getTestMode ver <- annexVersion <$> getTestMode
if ver == Annex.Version.defaultVersion git_annex "init" ["-q", new, "--version", show (Types.RepoVersion.fromRepoVersion ver)] @? "git annex init failed"
then git_annex "init" ["-q", new] @? "git annex init failed"
else git_annex "init" ["-q", new, "--version", show (Types.RepoVersion.fromRepoVersion ver)] @? "git annex init failed"
unless (bareClone cfg) $ unless (bareClone cfg) $
indir new $ indir new $
setupTestMode setupTestMode