include credPairRemoteFields in RemoteConfigParsers

Avoids parse error when the fields are added to RemoteConfig at setup
time and it then gets parsed, also at setup time. After setup time, such
internally added fields are not a problem, because they're Accepted. So
it may not be necessary in all cases to list such internally added
fields, but I think it's a good idea to always do so.
This commit is contained in:
Joey Hess 2020-01-15 10:57:45 -04:00
parent 0706d9d093
commit 7f2bfd41d7
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 12 additions and 2 deletions

View file

@ -49,6 +49,7 @@ remote = specialRemoteType $ RemoteType
, generate = gen
, configParser = mkRemoteConfigParser
[ optionalStringParser urlField
, optionalStringParser davcredsField
]
, setup = webdavSetup
, exportSupported = exportIsSupported
@ -58,6 +59,9 @@ remote = specialRemoteType $ RemoteType
urlField :: RemoteConfigField
urlField = Accepted "url"
davcredsField :: RemoteConfigField
davcredsField = Accepted "davcreds"
gen :: Git.Repo -> UUID -> ParsedRemoteConfig -> RemoteGitConfig -> RemoteStateHandle -> Annex (Maybe Remote)
gen r u c gc rs = new <$> remoteCost gc expensiveRemoteCost
where
@ -351,7 +355,7 @@ davCreds :: UUID -> CredPairStorage
davCreds u = CredPairStorage
{ credPairFile = fromUUID u
, credPairEnvironment = ("WEBDAV_USERNAME", "WEBDAV_PASSWORD")
, credPairRemoteField = Accepted "davcreds"
, credPairRemoteField = davcredsField
}
{- Content-Type to use for files uploaded to WebDAV. -}