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
setDifferences
unlessM (isJust <$> getVersion) $
setVersion (fromMaybe defaultVersion mversion)
ifM (crippledFileSystem <&&> (not <$> isBareRepo))
( setVersion (fromMaybe versionForCrippledFilesystem mversion)
, setVersion (fromMaybe defaultVersion mversion)
)
whenM versionSupportsUnlockedPointers $ do
configureSmudgeFilter
scanUnlockedFiles
@ -286,11 +289,12 @@ propigateSecureHashesOnly =
=<< getGlobalConfig "annex.securehashesonly"
adjustToCrippledFilesystem :: Annex ()
adjustToCrippledFilesystem = ifM (liftIO $ AdjustedBranch.isGitVersionSupported)
( do
void $ upgrade True versionForCrippledFilesystem
AdjustedBranch.adjustToCrippledFileSystem
, enableDirectMode
adjustToCrippledFilesystem = ifM versionSupportsAdjustedBranch
( ifM (liftIO $ AdjustedBranch.isGitVersionSupported)
( AdjustedBranch.adjustToCrippledFileSystem
, enableDirectMode
)
, enableDirectMode
)
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
with versioning).
* 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

View file

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

View file

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