fix init in cripped filesystem version issues
* init: When a crippled filesystem causes an adjusted unlocked branch to be used, set repo version to 7, which it neglected to do before. * init: When on a crippled filesystem, and the git version is too old to use an adjusted unlocked branch, fall back to using direct mode. This commit was sponsored by Ilya Shlyakhter on Patreon.
This commit is contained in:
parent
89abe04eb8
commit
865d556103
4 changed files with 34 additions and 6 deletions
|
@ -28,6 +28,7 @@ module Annex.AdjustedBranch (
|
||||||
checkAdjustedClone,
|
checkAdjustedClone,
|
||||||
isSupported,
|
isSupported,
|
||||||
checkVersionSupported,
|
checkVersionSupported,
|
||||||
|
isGitVersionSupported,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
|
@ -227,6 +228,7 @@ updateAdjustedBranch adj@(LinkAdjustment _) _ origbranch = preventCommits $ \com
|
||||||
adjustToCrippledFileSystem :: Annex ()
|
adjustToCrippledFileSystem :: Annex ()
|
||||||
adjustToCrippledFileSystem = do
|
adjustToCrippledFileSystem = do
|
||||||
warning "Entering an adjusted branch where files are unlocked as this filesystem does not support locked files."
|
warning "Entering an adjusted branch where files are unlocked as this filesystem does not support locked files."
|
||||||
|
checkVersionSupported
|
||||||
whenM (isNothing <$> originalBranch) $
|
whenM (isNothing <$> originalBranch) $
|
||||||
void $ inRepo $ Git.Branch.commitCommand Git.Branch.AutomaticCommit
|
void $ inRepo $ Git.Branch.commitCommand Git.Branch.AutomaticCommit
|
||||||
[ Param "--quiet"
|
[ Param "--quiet"
|
||||||
|
|
|
@ -23,6 +23,7 @@ import qualified Annex
|
||||||
import qualified Git
|
import qualified Git
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
import qualified Git.Objects
|
import qualified Git.Objects
|
||||||
|
import qualified Git.LsFiles
|
||||||
import qualified Annex.Branch
|
import qualified Annex.Branch
|
||||||
import Logs.UUID
|
import Logs.UUID
|
||||||
import Logs.Trust.Basic
|
import Logs.Trust.Basic
|
||||||
|
@ -32,11 +33,12 @@ 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
|
||||||
import Annex.Direct
|
import Annex.Direct
|
||||||
import Annex.AdjustedBranch
|
import qualified Annex.AdjustedBranch as AdjustedBranch
|
||||||
import Annex.Environment
|
import Annex.Environment
|
||||||
import Annex.Hook
|
import Annex.Hook
|
||||||
import Annex.InodeSentinal
|
import Annex.InodeSentinal
|
||||||
|
@ -114,13 +116,13 @@ initialize' ai mversion = checkCanInitialize ai $ do
|
||||||
unlessM isBareRepo $ do
|
unlessM isBareRepo $ do
|
||||||
hookWrite postCheckoutHook
|
hookWrite postCheckoutHook
|
||||||
hookWrite postMergeHook
|
hookWrite postMergeHook
|
||||||
checkAdjustedClone >>= \case
|
AdjustedBranch.checkAdjustedClone >>= \case
|
||||||
NeedUpgradeForAdjustedClone ->
|
AdjustedBranch.NeedUpgradeForAdjustedClone ->
|
||||||
void $ upgrade True versionForAdjustedClone
|
void $ upgrade True versionForAdjustedClone
|
||||||
InAdjustedClone -> return ()
|
AdjustedBranch.InAdjustedClone -> return ()
|
||||||
NotInAdjustedClone ->
|
AdjustedBranch.NotInAdjustedClone ->
|
||||||
ifM (crippledFileSystem <&&> (not <$> isBareRepo))
|
ifM (crippledFileSystem <&&> (not <$> isBareRepo))
|
||||||
( adjustToCrippledFileSystem
|
( adjustToCrippledFilesystem
|
||||||
-- 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
|
||||||
|
@ -282,3 +284,20 @@ propigateSecureHashesOnly :: Annex ()
|
||||||
propigateSecureHashesOnly =
|
propigateSecureHashesOnly =
|
||||||
maybe noop (setConfig (ConfigKey "annex.securehashesonly"))
|
maybe noop (setConfig (ConfigKey "annex.securehashesonly"))
|
||||||
=<< getGlobalConfig "annex.securehashesonly"
|
=<< getGlobalConfig "annex.securehashesonly"
|
||||||
|
|
||||||
|
adjustToCrippledFilesystem :: Annex ()
|
||||||
|
adjustToCrippledFilesystem = ifM (liftIO $ AdjustedBranch.isGitVersionSupported)
|
||||||
|
( do
|
||||||
|
void $ upgrade True versionForCrippledFilesystem
|
||||||
|
AdjustedBranch.adjustToCrippledFileSystem
|
||||||
|
, enableDirectMode
|
||||||
|
)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
|
@ -28,6 +28,9 @@ supportedVersions = map RepoVersion [5, 7]
|
||||||
versionForAdjustedClone :: RepoVersion
|
versionForAdjustedClone :: RepoVersion
|
||||||
versionForAdjustedClone = RepoVersion 7
|
versionForAdjustedClone = RepoVersion 7
|
||||||
|
|
||||||
|
versionForCrippledFilesystem :: RepoVersion
|
||||||
|
versionForCrippledFilesystem = RepoVersion 7
|
||||||
|
|
||||||
upgradableVersions :: [RepoVersion]
|
upgradableVersions :: [RepoVersion]
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
upgradableVersions = map RepoVersion [0..6]
|
upgradableVersions = map RepoVersion [0..6]
|
||||||
|
|
|
@ -5,6 +5,10 @@ git-annex (7.20181122) UNRELEASED; urgency=medium
|
||||||
Thanks, Robert Schütz
|
Thanks, Robert Schütz
|
||||||
* When running youtube-dl to get a filename, pass --no-playlist.
|
* When running youtube-dl to get a filename, pass --no-playlist.
|
||||||
* Fix build without concurrent-output.
|
* Fix build without concurrent-output.
|
||||||
|
* init: When a crippled filesystem causes an adjusted unlocked branch to
|
||||||
|
be used, set repo version to 7, which it neglected to do before.
|
||||||
|
* init: When on a crippled filesystem, and the git version is too old
|
||||||
|
to use an adjusted unlocked branch, fall back to using direct mode.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Tue, 27 Nov 2018 12:29:27 -0400
|
-- Joey Hess <id@joeyh.name> Tue, 27 Nov 2018 12:29:27 -0400
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue