remoteConfig rework

remoteAnnexConfig will avoid bugs like
a3a674d15b

Use now more generic remoteConfig in a couple places that built
non-annex config settings manually before.
This commit is contained in:
Joey Hess 2020-02-19 13:45:11 -04:00
parent a3a674d15b
commit 69f2d1dd43
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
17 changed files with 30 additions and 26 deletions

View file

@ -169,7 +169,7 @@ externalSetup _ mu _ c gc = do
c'' <- case getRemoteConfigValue readonlyField pc of
Just True -> do
setConfig (remoteConfig (fromJust (lookupName c)) "readonly") (boolConfig True)
setConfig (remoteAnnexConfig (fromJust (lookupName c)) "readonly") (boolConfig True)
return c'
_ -> do
pc' <- either giveup return $ parseRemoteConfig c' lenientRemoteConfigParser

View file

@ -113,7 +113,7 @@ gen baser u c gc rs = do
. parseRemoteConfig c'
=<< configParser remote c'
setGcryptEncryption pc remotename
storeUUIDIn (remoteConfig baser "uuid") u'
storeUUIDIn (remoteAnnexConfig baser "uuid") u'
setConfig (Git.GCrypt.remoteConfigKey "gcrypt-id" remotename) gcryptid
gen' r u' pc gc rs
_ -> do

View file

@ -98,10 +98,10 @@ list autoinit = do
rs <- mapM (tweakurl c) =<< Annex.getGitRemotes
mapM (configRead autoinit) rs
where
annexurl n = Git.ConfigKey ("remote." <> encodeBS' n <> ".annexurl")
annexurl r = remoteConfig r "annexurl"
tweakurl c r = do
let n = fromJust $ Git.remoteName r
case M.lookup (annexurl n) c of
case M.lookup (annexurl r) c of
Nothing -> return r
Just url -> inRepo $ \g ->
Git.Construct.remoteNamed n $
@ -256,7 +256,7 @@ tryGitConfigRead autoinit r
| otherwise -> configlist_failed
Left _ -> configlist_failed
| Git.repoIsHttp r = storeUpdatedRemote geturlconfig
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteConfig r "uuid")
| Git.GCrypt.isEncrypted r = handlegcrypt =<< getConfigMaybe (remoteAnnexConfig r "uuid")
| Git.repoIsUrl r = return r
| otherwise = storeUpdatedRemote $ liftIO $
readlocalannexconfig `catchNonAsync` (const $ return r)

View file

@ -166,7 +166,7 @@ mySetup _ mu _ c gc = do
-- (so it's also usable by git as a non-special remote),
-- and set remote.name.annex-git-lfs = true
gitConfigSpecialRemote u c' [("git-lfs", "true")]
setConfig (Git.ConfigKey ("remote." <> encodeBS' (getRemoteName c) <> ".url")) url
setConfig (remoteConfig (getRemoteName c) "url") url
return (c', u)
where
url = maybe (giveup "Specify url=") fromProposedAccepted
@ -201,7 +201,7 @@ configKnownUrl r
set "config-uuid" (fromUUID cu) r'
Nothing -> return r'
set k v r' = do
let k' = remoteConfig r' k
let k' = remoteAnnexConfig r' k
setConfig k' v
return $ Git.Config.store' k' (Git.ConfigValue (encodeBS' v)) r'

View file

@ -81,8 +81,8 @@ findSpecialRemotes s = do
gitConfigSpecialRemote :: UUID -> RemoteConfig -> [(String, String)] -> Annex ()
gitConfigSpecialRemote u c cfgs = do
forM_ cfgs $ \(k, v) ->
setConfig (remoteConfig c (encodeBS' k)) v
storeUUIDIn (remoteConfig c "uuid") u
setConfig (remoteAnnexConfig c (encodeBS' k)) v
storeUUIDIn (remoteAnnexConfig c "uuid") u
-- RetrievalVerifiableKeysSecure unless overridden by git config.
--