default to v7 adjusted unlocked in crippled filesystem

init: When in a crippled filesystem, initialize a v7 repository using an
adjusted unlocked branch, instead of a direct mode repository.

Direct mode is deprecated, so this makes sense to do already I hope.

This commit was sponsored by Ole-Morten Duesund on Patreon.
This commit is contained in:
Joey Hess 2018-10-25 18:49:57 -04:00
parent 5bb4308e1f
commit d59995b9ee
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 4 additions and 18 deletions

View file

@ -21,7 +21,6 @@ module Annex.Init (
import Annex.Common import Annex.Common
import qualified Annex import qualified Annex
import qualified Git import qualified Git
import qualified Git.LsFiles
import qualified Git.Config import qualified Git.Config
import qualified Git.Objects import qualified Git.Objects
import qualified Annex.Branch import qualified Annex.Branch
@ -33,7 +32,6 @@ import Types.RepoVersion
import Annex.Version import Annex.Version
import Annex.Difference import Annex.Difference
import Annex.UUID import Annex.UUID
import Annex.Link
import Annex.WorkTree import Annex.WorkTree
import Config import Config
import Config.Smudge import Config.Smudge
@ -118,16 +116,11 @@ initialize' ai mversion = checkCanInitialize ai $ do
hookWrite postMergeHook hookWrite postMergeHook
checkAdjustedClone >>= \case checkAdjustedClone >>= \case
NeedUpgradeForAdjustedClone -> NeedUpgradeForAdjustedClone ->
void $ upgrade True versionForAdjustedClone void $ upgrade True versionForAdjustedClone
InAdjustedClone -> return () InAdjustedClone -> return ()
NotInAdjustedClone -> NotInAdjustedClone ->
ifM (crippledFileSystem <&&> (not <$> isBareRepo)) ifM (crippledFileSystem <&&> (not <$> isBareRepo))
( ifM versionSupportsUnlockedPointers ( adjustToCrippledFileSystem
( adjustToCrippledFileSystem
, do
enableDirectMode
setDirect True
)
-- Handle case where this repo was cloned from a -- Handle case where this repo was cloned from a
-- direct mode repo -- direct mode repo
, unlessM isBareRepo , unlessM isBareRepo
@ -270,15 +263,6 @@ checkFifoSupport = unlessM probeFifoSupport $ do
warning "Disabling ssh connection caching." warning "Disabling ssh connection caching."
setConfig (annexConfig "sshcaching") (Git.Config.boolConfig False) setConfig (annexConfig "sshcaching") (Git.Config.boolConfig False)
enableDirectMode :: Annex ()
enableDirectMode = unlessM isDirect $ do
warning "Enabling direct mode."
top <- fromRepo Git.repoPath
(l, clean) <- inRepo $ Git.LsFiles.inRepo [top]
forM_ l $ \f ->
maybe noop (`toDirect` f) =<< isAnnexLink f
void $ liftIO clean
checkSharedClone :: Annex Bool checkSharedClone :: Annex Bool
checkSharedClone = inRepo Git.Objects.isSharedClone checkSharedClone = inRepo Git.Objects.isSharedClone

View file

@ -6,6 +6,8 @@ git-annex (7.20181025) UNRELEASED; urgency=medium
* Direct mode repositories are deprecated; they have many problems * Direct mode repositories are deprecated; they have many problems
that v7 fixes, so upgrading them now is recommended (but not yet that v7 fixes, so upgrading them now is recommended (but not yet
required): git annex upgrade --version=7 required): git annex upgrade --version=7
* init: When in a crippled filesystem, initialize a v7 repository
using an adjusted unlocked branch, instead of a direct mode repository.
* At long last there's a way to hide annexed files whose content * At long last there's a way to hide annexed files whose content
is missing from the working tree: git-annex adjust --hide-missing is missing from the working tree: git-annex adjust --hide-missing
See https://git-annex.branchable.com/tips/hiding_missing_files/ See https://git-annex.branchable.com/tips/hiding_missing_files/