annex.autocommit can be configured via git-annex config

... to control the default behavior in all clones of a repository.

This includes a new Configurable data type, so the GitConfig type indicates
which values can be configured this way.

The implementation should be quite efficient; the config log is only read
once, and only when a Configurable value has not already been set by
git-config.

Indeed, it would be nice in the future to extend this, so that git-config
is itself only read on demand. Some commands may not need to look at the
git configuration at all.

This commit was sponsored by Trenton Cronholm on Patreon.
This commit is contained in:
Joey Hess 2017-02-03 13:40:14 -04:00
parent d6d23d8a15
commit ed56dba868
No known key found for this signature in database
GPG key ID: C910D9222512E3C7
14 changed files with 93 additions and 26 deletions

View file

@ -43,6 +43,7 @@ import Utility.Gpg
import Annex.UUID
import Assistant.Ssh
import Config
import Config.GitConfig
import qualified Data.Text as T
import qualified Data.Map as M
@ -76,7 +77,7 @@ getRepoConfig uuid mremote = do
syncable <- case mremote of
Just r -> return $ remoteAnnexSync $ Remote.gitconfig r
Nothing -> annexAutoCommit <$> Annex.getGitConfig
Nothing -> getGitConfigVal annexAutoCommit
return $ RepoConfig
(T.pack $ maybe "here" Remote.name mremote)

View file

@ -12,7 +12,6 @@ module Assistant.WebApp.RepoList where
import Assistant.WebApp.Common
import Assistant.DaemonStatus
import Assistant.WebApp.Notifications
import qualified Annex
import qualified Remote
import qualified Types.Remote as Remote
import Remote.List (remoteListRefresh)
@ -21,6 +20,7 @@ import Logs.Remote
import Logs.Trust
import Logs.Group
import Config
import Config.GitConfig
import Git.Remote
import Assistant.Sync
import Config.Cost
@ -152,7 +152,7 @@ repoList reposelector
if includeHere reposelector
then do
r <- RepoUUID <$> getUUID
autocommit <- annexAutoCommit <$> Annex.getGitConfig
autocommit <- getGitConfigVal annexAutoCommit
let hereactions = if autocommit
then mkSyncingRepoActions r
else mkNotSyncingRepoActions r