move repoConfig out of Remotes
This commit is contained in:
parent
acde7a1736
commit
aad1372880
3 changed files with 21 additions and 21 deletions
15
Annex.hs
15
Annex.hs
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue