support boolean git configs that are represented by the name of the setting with no value

Eg"core.bare" is the same as "core.bare = true".

Note that git treats "core.bare =" the same as "core.bare = false", so the
code had to become more complicated in order to treat the absense of a
value differently than an empty value. Ugh.
This commit is contained in:
Joey Hess 2020-04-13 13:35:22 -04:00
parent ca9c6c5f60
commit 9cb69dbb76
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 35 additions and 7 deletions

View file

@ -69,8 +69,9 @@ seek (UnsetConfig ck@(ConfigKey name)) = checkIsGlobalConfig ck $ commandAction
seek (GetConfig ck) = checkIsGlobalConfig ck $ commandAction $
startingCustomOutput (ActionItemOther Nothing) $ do
getGlobalConfig ck >>= \case
Nothing -> return ()
Just (ConfigValue v) -> liftIO $ S8.putStrLn v
Just NoConfigValue -> return ()
Nothing -> return ()
next $ return True
checkIsGlobalConfig :: ConfigKey -> Annex a -> Annex a