From 26887745a0f46837cb76ea3c48b69f972a19f7a8 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 2 Jun 2016 16:59:15 -0400 Subject: [PATCH] refactor isBareRepo --- Annex/Init.hs | 9 +++------ Command.hs | 3 --- Command/Unused.hs | 1 + Config.hs | 3 +++ 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Annex/Init.hs b/Annex/Init.hs index f2996993a1..e12a8bc80f 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -85,7 +85,7 @@ initialize' mversion = do checkLockSupport checkFifoSupport checkCrippledFileSystem - unlessM isBare $ + unlessM isBareRepo $ hookWrite preCommitHook setDifferences unlessM (isJust <$> getVersion) $ @@ -98,7 +98,7 @@ initialize' mversion = do NeedUpgradeForAdjustedClone -> void $ upgrade True InAdjustedClone -> return () NotInAdjustedClone -> - ifM (crippledFileSystem <&&> (not <$> isBare)) + ifM (crippledFileSystem <&&> (not <$> isBareRepo)) ( ifM versionSupportsUnlockedPointers ( adjustToCrippledFileSystem , do @@ -107,7 +107,7 @@ initialize' mversion = do ) -- Handle case where this repo was cloned from a -- direct mode repo - , unlessM isBare + , unlessM isBareRepo switchHEADBack ) createInodeSentinalFile False @@ -137,9 +137,6 @@ ensureInitialized = getVersion >>= maybe needsinit checkUpgrade isInitialized :: Annex Bool 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, - or removing write access from files. -} probeCrippledFileSystem :: Annex Bool diff --git a/Command.hs b/Command.hs index 9f45e088f5..82c8b3cc16 100644 --- a/Command.hs +++ b/Command.hs @@ -91,9 +91,6 @@ stop = return Nothing stopUnless :: Annex Bool -> Annex (Maybe a) -> Annex (Maybe a) stopUnless c a = ifM c ( a , stop ) -isBareRepo :: Annex Bool -isBareRepo = fromRepo Git.repoIsLocalBare - commonChecks :: [CommandCheck] commonChecks = [repoExists] diff --git a/Command/Unused.hs b/Command/Unused.hs index 8040dc21ac..c116cdc0e1 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -32,6 +32,7 @@ import Types.RefSpec import Git.Types import Git.Sha import Git.FilePath +import Config import Logs.View (is_branchView) import Annex.BloomFilter import qualified Database.Keys diff --git a/Config.hs b/Config.hs index 75d7b4ce76..be60852daa 100644 --- a/Config.hs +++ b/Config.hs @@ -86,6 +86,9 @@ setRemoteIgnore r b = setConfig (remoteConfig r "ignore") (Git.Config.boolConfig setRemoteBare :: Git.Repo -> Bool -> Annex () setRemoteBare r b = setConfig (remoteConfig r "bare") (Git.Config.boolConfig b) +isBareRepo :: Annex Bool +isBareRepo = fromRepo Git.repoIsLocalBare + isDirect :: Annex Bool isDirect = annexDirect <$> Annex.getGitConfig