Fix use of several config settings
annex.ssh-options, annex.rsync-options, annex.bup-split-options. And adjust types to avoid the bugs that broke several config settings recently. Now "annex." prefixing is enforced at the type level.
This commit is contained in:
parent
657d09d499
commit
f7d8982672
10 changed files with 49 additions and 33 deletions
|
@ -304,12 +304,12 @@ saveState oneshot = doSideAction $ do
|
|||
( Annex.Branch.commit "update" , Annex.Branch.stage)
|
||||
where
|
||||
alwayscommit = fromMaybe True . Git.configTrue
|
||||
<$> getConfig "annex.alwayscommit" ""
|
||||
<$> getConfig (annexConfig "alwayscommit") ""
|
||||
|
||||
{- Downloads content from any of a list of urls. -}
|
||||
downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool
|
||||
downloadUrl urls file = do
|
||||
o <- map Param . words <$> getConfig "annex.web-options" ""
|
||||
o <- map Param . words <$> getConfig (annexConfig "web-options") ""
|
||||
headers <- getHttpHeaders
|
||||
liftIO $ anyM (\u -> Url.download u headers o file) urls
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ new = do
|
|||
store q
|
||||
return q
|
||||
where
|
||||
queuesize = readish <$> getConfig "annex.queuesize" ""
|
||||
queuesize = readish <$> getConfig (annexConfig "queuesize") ""
|
||||
|
||||
store :: Git.Queue.Queue -> Annex ()
|
||||
store q = changeState $ \s -> s { repoqueue = Just q }
|
||||
|
|
|
@ -48,7 +48,7 @@ sshInfo (host, port) = ifM caching
|
|||
where
|
||||
caching = fromMaybe SysConfig.sshconnectioncaching
|
||||
. Git.configTrue
|
||||
<$> getConfig "annex.sshcaching" ""
|
||||
<$> getConfig (annexConfig "sshcaching") ""
|
||||
|
||||
cacheParams :: FilePath -> [CommandParam]
|
||||
cacheParams socketfile =
|
||||
|
|
|
@ -23,12 +23,11 @@ module Annex.UUID (
|
|||
import Common.Annex
|
||||
import qualified Git
|
||||
import qualified Git.Config
|
||||
import qualified Git.Command
|
||||
import qualified Build.SysConfig as SysConfig
|
||||
import Config
|
||||
|
||||
configkey :: String
|
||||
configkey = "annex.uuid"
|
||||
configkey :: ConfigKey
|
||||
configkey = annexConfig "uuid"
|
||||
|
||||
{- Generates a UUID. There is a library for this, but it's not packaged,
|
||||
- so use the command line tool. -}
|
||||
|
@ -64,16 +63,17 @@ getRepoUUID r = do
|
|||
cachekey = remoteConfig r "uuid"
|
||||
|
||||
removeRepoUUID :: Annex ()
|
||||
removeRepoUUID = inRepo $ Git.Command.run "config"
|
||||
[Param "--unset", Param configkey]
|
||||
removeRepoUUID = unsetConfig configkey
|
||||
|
||||
getUncachedUUID :: Git.Repo -> UUID
|
||||
getUncachedUUID = toUUID . Git.Config.get configkey ""
|
||||
getUncachedUUID = toUUID . Git.Config.get key ""
|
||||
where
|
||||
(ConfigKey key) = configkey
|
||||
|
||||
{- Make sure that the repo has an annex.uuid setting. -}
|
||||
prepUUID :: Annex ()
|
||||
prepUUID = whenM ((==) NoUUID <$> getUUID) $
|
||||
storeUUID configkey =<< liftIO genUUID
|
||||
|
||||
storeUUID :: String -> UUID -> Annex ()
|
||||
storeUUID :: ConfigKey -> UUID -> Annex ()
|
||||
storeUUID configfield = setConfig configfield . fromUUID
|
||||
|
|
|
@ -21,8 +21,8 @@ supportedVersions = [defaultVersion]
|
|||
upgradableVersions :: [Version]
|
||||
upgradableVersions = ["0", "1", "2"]
|
||||
|
||||
versionField :: String
|
||||
versionField = "annex.version"
|
||||
versionField :: ConfigKey
|
||||
versionField = annexConfig "version"
|
||||
|
||||
getVersion :: Annex (Maybe Version)
|
||||
getVersion = handle <$> getConfig versionField ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue