refactor isBareRepo

This commit is contained in:
Joey Hess 2016-06-02 16:59:15 -04:00
parent c8dd196234
commit 26887745a0
Failed to extract signature
4 changed files with 7 additions and 9 deletions

View file

@ -85,7 +85,7 @@ initialize' mversion = do
checkLockSupport checkLockSupport
checkFifoSupport checkFifoSupport
checkCrippledFileSystem checkCrippledFileSystem
unlessM isBare $ unlessM isBareRepo $
hookWrite preCommitHook hookWrite preCommitHook
setDifferences setDifferences
unlessM (isJust <$> getVersion) $ unlessM (isJust <$> getVersion) $
@ -98,7 +98,7 @@ initialize' mversion = do
NeedUpgradeForAdjustedClone -> void $ upgrade True NeedUpgradeForAdjustedClone -> void $ upgrade True
InAdjustedClone -> return () InAdjustedClone -> return ()
NotInAdjustedClone -> NotInAdjustedClone ->
ifM (crippledFileSystem <&&> (not <$> isBare)) ifM (crippledFileSystem <&&> (not <$> isBareRepo))
( ifM versionSupportsUnlockedPointers ( ifM versionSupportsUnlockedPointers
( adjustToCrippledFileSystem ( adjustToCrippledFileSystem
, do , do
@ -107,7 +107,7 @@ initialize' mversion = do
) )
-- 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 isBare , unlessM isBareRepo
switchHEADBack switchHEADBack
) )
createInodeSentinalFile False createInodeSentinalFile False
@ -137,9 +137,6 @@ ensureInitialized = getVersion >>= maybe needsinit checkUpgrade
isInitialized :: Annex Bool isInitialized :: Annex Bool
isInitialized = maybe Annex.Branch.hasSibling (const $ return True) =<< getVersion isInitialized = maybe Annex.Branch.hasSibling (const $ return True) =<< getVersion
isBare :: Annex Bool
isBare = fromRepo Git.repoIsLocalBare
{- A crippled filesystem is one that does not allow making symlinks, {- A crippled filesystem is one that does not allow making symlinks,
- or removing write access from files. -} - or removing write access from files. -}
probeCrippledFileSystem :: Annex Bool probeCrippledFileSystem :: Annex Bool

View file

@ -91,9 +91,6 @@ stop = return Nothing
stopUnless :: Annex Bool -> Annex (Maybe a) -> Annex (Maybe a) stopUnless :: Annex Bool -> Annex (Maybe a) -> Annex (Maybe a)
stopUnless c a = ifM c ( a , stop ) stopUnless c a = ifM c ( a , stop )
isBareRepo :: Annex Bool
isBareRepo = fromRepo Git.repoIsLocalBare
commonChecks :: [CommandCheck] commonChecks :: [CommandCheck]
commonChecks = [repoExists] commonChecks = [repoExists]

View file

@ -32,6 +32,7 @@ import Types.RefSpec
import Git.Types import Git.Types
import Git.Sha import Git.Sha
import Git.FilePath import Git.FilePath
import Config
import Logs.View (is_branchView) import Logs.View (is_branchView)
import Annex.BloomFilter import Annex.BloomFilter
import qualified Database.Keys import qualified Database.Keys

View file

@ -86,6 +86,9 @@ setRemoteIgnore r b = setConfig (remoteConfig r "ignore") (Git.Config.boolConfig
setRemoteBare :: Git.Repo -> Bool -> Annex () setRemoteBare :: Git.Repo -> Bool -> Annex ()
setRemoteBare r b = setConfig (remoteConfig r "bare") (Git.Config.boolConfig b) setRemoteBare r b = setConfig (remoteConfig r "bare") (Git.Config.boolConfig b)
isBareRepo :: Annex Bool
isBareRepo = fromRepo Git.repoIsLocalBare
isDirect :: Annex Bool isDirect :: Annex Bool
isDirect = annexDirect <$> Annex.getGitConfig isDirect = annexDirect <$> Annex.getGitConfig