refactoring

This commit is contained in:
Joey Hess 2019-01-29 13:42:32 -04:00
parent 365c9767af
commit c4977ec1ff
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 8 additions and 5 deletions
Config.hs
Remote/Helper

View file

@ -1,6 +1,6 @@
{- Git configuration
-
- Copyright 2011-2017 Joey Hess <id@joeyh.name>
- Copyright 2011-2019 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@ -20,6 +20,8 @@ import Types.Availability
import Git.Types
import qualified Types.Remote as Remote
import qualified Data.Map as M
type UnqualifiedConfigKey = String
data ConfigKey = ConfigKey String
@ -59,6 +61,9 @@ instance RemoteNameable RemoteName where
instance RemoteNameable Remote where
getRemoteName = Remote.name
instance RemoteNameable Remote.RemoteConfig where
getRemoteName c = fromMaybe "" (M.lookup "name" c)
{- A per-remote config setting in git config. -}
remoteConfig :: RemoteNameable r => r -> UnqualifiedConfigKey -> ConfigKey
remoteConfig r key = ConfigKey $

View file

@ -69,10 +69,8 @@ findSpecialRemotes s = do
gitConfigSpecialRemote :: UUID -> RemoteConfig -> [(String, String)] -> Annex ()
gitConfigSpecialRemote u c cfgs = do
forM_ cfgs $ \(k, v) ->
setConfig (remoteConfig remotename k) v
setConfig (remoteConfig remotename "uuid") (fromUUID u)
where
remotename = fromJust (M.lookup "name" c)
setConfig (remoteConfig c k) v
setConfig (remoteConfig c "uuid") (fromUUID u)
-- RetrievalVerifiableKeysSecure unless overridden by git config.
--