summaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-13 15:05:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-13 15:06:49 -0400
commit13fff71f2019ae098c3f8532ac2734cb1ab11498 (patch)
treef37714c4089df4afac9bf9724c80757e5fd29e6f /Config.hs
parent46588674b081cd4ea5820680d8fc15c81ed175ad (diff)
split out three modules from Git
Constructors and configuration make sense in separate modules. A separate Git.Types is needed to avoid cycles.
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Config.hs b/Config.hs
index c6107fc8e..322dc8af8 100644
--- a/Config.hs
+++ b/Config.hs
@@ -9,6 +9,7 @@ module Config where
import Common.Annex
import qualified Git
+import qualified Git.Config
import qualified Annex
type ConfigKey = String
@@ -18,15 +19,15 @@ setConfig :: ConfigKey -> String -> Annex ()
setConfig k value = do
inRepo $ Git.run "config" [Param k, Param value]
-- re-read git config and update the repo's state
- newg <- inRepo Git.configRead
+ newg <- inRepo Git.Config.read
Annex.changeState $ \s -> s { Annex.repo = newg }
{- Looks up a per-remote config setting in git config.
- Failing that, tries looking for a global config option. -}
getConfig :: Git.Repo -> ConfigKey -> String -> Annex String
getConfig r key def = do
- def' <- fromRepo $ Git.configGet ("annex." ++ key) def
- fromRepo $ Git.configGet (remoteConfig r key) def'
+ def' <- fromRepo $ Git.Config.get ("annex." ++ key) def
+ fromRepo $ Git.Config.get (remoteConfig r key) def'
{- Looks up a per-remote config setting in git config. -}
remoteConfig :: Git.Repo -> ConfigKey -> String
@@ -83,6 +84,6 @@ getNumCopies v = perhaps (use v) =<< Annex.getState Annex.forcenumcopies
where
use (Just n) = return n
use Nothing = perhaps (return 1) =<<
- readMaybe <$> fromRepo (Git.configGet config "1")
+ readMaybe <$> fromRepo (Git.Config.get config "1")
perhaps fallback = maybe fallback (return . id)
config = "annex.numcopies"