add annex-ignore-command and annex-sync-command configs

Added remote configuration settings annex-ignore-command and
annex-sync-command, which are dynamic equivilants of the annex-ignore
and annex-sync configurations.

For this I needed a new DynamicConfig infrastructure. Its implementation
should be as fast as before when there is no dynamic config, and it caches
so shell commands are only run once.

Note that annex-ignore-command exits nonzero when the remote should be ignored.
While that may seem backwards, it allows using the same command for it as
for annex-sync-command when you want to disable both.

This commit was sponsored by Trenton Cronholm on Patreon.
This commit is contained in:
Joey Hess 2017-08-17 12:26:14 -04:00
parent 86428f6261
commit d39c120afa
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
21 changed files with 201 additions and 92 deletions

View file

@ -35,6 +35,7 @@ import qualified Annex.Url as Url
import Utility.Tmp
import Config
import Config.Cost
import Config.DynamicConfig
import Annex.Init
import Annex.Version
import Types.CleanupActions
@ -128,7 +129,8 @@ configRead :: Bool -> Git.Repo -> Annex Git.Repo
configRead autoinit r = do
gc <- Annex.getRemoteGitConfig r
u <- getRepoUUID r
case (repoCheap r, remoteAnnexIgnore gc, u) of
annexignore <- liftIO $ getDynamicConfig (remoteAnnexIgnore gc)
case (repoCheap r, annexignore, u) of
(_, True, _) -> return r
(True, _, _) -> tryGitConfigRead autoinit r
(False, _, NoUUID) -> tryGitConfigRead autoinit r