aboutsummaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Config.hs b/Config.hs
index 1e4d6caec..ac251983a 100644
--- a/Config.hs
+++ b/Config.hs
@@ -36,8 +36,11 @@ setConfig (ConfigKey key) value = do
{- Unsets a git config setting. (Leaves it in state currently.) -}
unsetConfig :: ConfigKey -> Annex ()
-unsetConfig (ConfigKey key) = inRepo $ Git.Command.run
- [Param "config", Param "--unset", Param key]
+unsetConfig ck@(ConfigKey key) = ifM (isJust <$> getConfigMaybe ck)
+ ( inRepo $ Git.Command.run
+ [Param "config", Param "--unset", Param key]
+ , noop -- avoid unsetting something not set; that would fail
+ )
{- A per-remote config setting in git config. -}
remoteConfig :: Git.Repo -> UnqualifiedConfigKey -> ConfigKey