From 4bdd8083ad7d77de41a2389aed87805eb354d358 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Aug 2017 14:04:29 -0400 Subject: use DynamicConfig to handle cost-command This commit was sponsored by Jake Vosloo on Patreon. --- Types/GitConfig.hs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Types') diff --git a/Types/GitConfig.hs b/Types/GitConfig.hs index 6eea51998..d523c745a 100644 --- a/Types/GitConfig.hs +++ b/Types/GitConfig.hs @@ -192,8 +192,7 @@ mergeGitConfig gitconfig repoglobals = gitconfig - key such as .annex-foo, or if that is not set, a default from - annex.foo -} data RemoteGitConfig = RemoteGitConfig - { remoteAnnexCost :: Maybe Cost - , remoteAnnexCostCommand :: Maybe String + { remoteAnnexCost :: DynamicConfig (Maybe Cost) , remoteAnnexIgnore :: DynamicConfig Bool , remoteAnnexSync :: DynamicConfig Bool , remoteAnnexPull :: Bool @@ -231,6 +230,9 @@ data RemoteGitConfig = RemoteGitConfig extractRemoteGitConfig :: Git.Repo -> String -> STM RemoteGitConfig extractRemoteGitConfig r remotename = do + annexcost <- mkDynamicConfig readCommandRunner + (notempty $ getmaybe "cost-command") + (getmayberead "cost") annexignore <- mkDynamicConfig unsuccessfullCommandRunner (notempty $ getmaybe "ignore-command") (getbool "ignore" False) @@ -238,8 +240,7 @@ extractRemoteGitConfig r remotename = do (notempty $ getmaybe "sync-command") (getbool "sync" True) return $ RemoteGitConfig - { remoteAnnexCost = getmayberead "cost" - , remoteAnnexCostCommand = notempty $ getmaybe "cost-command" + { remoteAnnexCost = annexcost , remoteAnnexIgnore = annexignore , remoteAnnexSync = annexsync , remoteAnnexPull = getbool "pull" True -- cgit v1.2.3