diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-05 15:31:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-05 15:31:46 -0400 |
commit | aad1372880ba32f1161a0d05422008cba38bb412 (patch) | |
tree | 3ff855af958b091e9d31f6b94438a3b9c4f52550 /Annex.hs | |
parent | acde7a1736fdee58be0af0773da6e2d9e0c2d220 (diff) |
move repoConfig out of Remotes
Diffstat (limited to 'Annex.hs')
-rw-r--r-- | Annex.hs | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -16,10 +16,12 @@ module Annex ( gitRepo, queue, queueRun, - setConfig + setConfig, + repoConfig ) where import Control.Monad.State +import Data.Maybe import qualified GitRepo as Git import qualified GitQueue @@ -115,3 +117,14 @@ setConfig k value = do -- re-read git config and update the repo's state g' <- liftIO $ Git.configRead g Annex.changeState $ \s -> s { Annex.repo = g' } + +{- Looks up a per-remote config option in git config. + - Failing that, tries looking for a global config option. -} +repoConfig :: Git.Repo -> String -> String -> Annex String +repoConfig r key def = do + g <- Annex.gitRepo + let def' = Git.configGet g global def + return $ Git.configGet g local def' + where + local = "remote." ++ fromMaybe "" (Git.repoRemoteName r) ++ ".annex-" ++ key + global = "annex." ++ key |