When parsing git configs, support all the documented ways to write true and false, including "yes", "on", "1", etc.

This change does impact git-annex config
eg "git annex config --set annex.addunlocked on"
will store "on" and new git-annex will understand that value, while
old git-annex will error:
git-annex: bad annex.addunlocked configuration in git annex config:
Parse failure: near "on"
That seems acceptable.

Not special remote configs that are only documented as =true or =false
however. Having git-annex support other values for those would break
backwards compatability when used with old versions of git-annex. And
older versions ignore invalid special remote configs.. That would not
be a good combination.
This commit is contained in:
Joey Hess 2020-04-13 13:45:40 -04:00
parent 9cb69dbb76
commit 5a62e8132d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 21 additions and 4 deletions

View file

@ -22,7 +22,6 @@ import Config
import Remote.List
import Logs.Remote
import Logs.Trust
import qualified Git.Config
import qualified Types.Remote as Remote
import Git.Types (RemoteName)
@ -99,7 +98,7 @@ autoEnable = do
_ -> return ()
where
configured rc = fromMaybe False $
Git.Config.isTrueFalse . fromProposedAccepted
trueFalseParser' . fromProposedAccepted
=<< M.lookup autoEnableField rc
canenable u = (/= DeadTrusted) <$> lookupTrust u
getenabledremotes = M.fromList