fix --describe-other-params of external when encryption is not specified

Encryption not being specified makes lenientRemoteConfigParser fail
to parse, and so it was not able to start the external up to get
LISTCONFIGS.
This commit is contained in:
Joey Hess 2020-01-20 16:56:34 -04:00
parent 2be4122bfc
commit 830c30001b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -784,19 +784,22 @@ getInfoM external = (++)
{- All unknown configs are passed through in case the external program {- All unknown configs are passed through in case the external program
- uses them. -} - uses them. -}
lenientRemoteConfigParser :: RemoteConfigParser lenientRemoteConfigParser :: RemoteConfigParser
lenientRemoteConfigParser = addRemoteConfigParser specialRemoteConfigParsers $ lenientRemoteConfigParser =
RemoteConfigParser addRemoteConfigParser specialRemoteConfigParsers baseRemoteConfigParser
{ remoteConfigFieldParsers =
[ optionalStringParser externaltypeField baseRemoteConfigParser :: RemoteConfigParser
(FieldDesc "type of external special remote to use") baseRemoteConfigParser = RemoteConfigParser
, trueFalseParser readonlyField False { remoteConfigFieldParsers =
(FieldDesc "enable readonly mode") [ optionalStringParser externaltypeField
] (FieldDesc "type of external special remote to use")
, remoteConfigRestPassthrough = Just , trueFalseParser readonlyField False
( const True (FieldDesc "enable readonly mode")
, [("*", FieldDesc "all other parameters are passed to external special remote program")] ]
) , remoteConfigRestPassthrough = Just
} ( const True
, [("*", FieldDesc "all other parameters are passed to external special remote program")]
)
}
{- When the remote supports LISTCONFIGS, only accept the ones it listed. {- When the remote supports LISTCONFIGS, only accept the ones it listed.
- When it does not, accept all configs. -} - When it does not, accept all configs. -}
@ -826,7 +829,7 @@ remoteConfigParser c
-- cases the lenient parser will do the same thing as the strict -- cases the lenient parser will do the same thing as the strict
-- parser. -- parser.
| M.null (M.filter isproposed c) = return lenientRemoteConfigParser | M.null (M.filter isproposed c) = return lenientRemoteConfigParser
| otherwise = case parseRemoteConfig c lenientRemoteConfigParser of | otherwise = case parseRemoteConfig c baseRemoteConfigParser of
Left _ -> return lenientRemoteConfigParser Left _ -> return lenientRemoteConfigParser
Right pc -> case (getRemoteConfigValue externaltypeField pc, getRemoteConfigValue readonlyField pc) of Right pc -> case (getRemoteConfigValue externaltypeField pc, getRemoteConfigValue readonlyField pc) of
(Nothing, _) -> return lenientRemoteConfigParser (Nothing, _) -> return lenientRemoteConfigParser