aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex.hs21
-rw-r--r--CmdLine/GitAnnex/Options.hs5
-rw-r--r--debian/changelog2
3 files changed, 21 insertions, 7 deletions
diff --git a/Annex.hs b/Annex.hs
index 4f26c497c..d9c512f3f 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -30,6 +30,7 @@ module Annex (
getGitConfig,
changeGitConfig,
changeGitRepo,
+ adjustGitRepo,
getRemoteGitConfig,
withCurrentState,
changeDirectory,
@@ -95,6 +96,7 @@ newtype Annex a = Annex { runAnnex :: ReaderT (MVar AnnexState) IO a }
-- internal state storage
data AnnexState = AnnexState
{ repo :: Git.Repo
+ , repoadjustment :: (Git.Repo -> IO Git.Repo)
, gitconfig :: GitConfig
, backends :: [BackendA Annex]
, remotes :: [Types.Remote.RemoteA Annex]
@@ -141,6 +143,7 @@ data AnnexState = AnnexState
newState :: GitConfig -> Git.Repo -> AnnexState
newState c r = AnnexState
{ repo = r
+ , repoadjustment = return
, gitconfig = c
, backends = []
, remotes = []
@@ -295,10 +298,20 @@ changeGitConfig a = changeState $ \s -> s { gitconfig = a (gitconfig s) }
{- Changing the git Repo data also involves re-extracting its GitConfig. -}
changeGitRepo :: Git.Repo -> Annex ()
-changeGitRepo r = changeState $ \s -> s
- { repo = r
- , gitconfig = extractGitConfig r
- }
+changeGitRepo r = do
+ adjuster <- getState repoadjustment
+ r' <- liftIO $ adjuster r
+ changeState $ \s -> s
+ { repo = r'
+ , gitconfig = extractGitConfig r'
+ }
+
+{- Adds an adjustment to the Repo data. Adjustments persist across reloads
+ - of the repo's config. -}
+adjustGitRepo :: (Git.Repo -> IO Git.Repo) -> Annex ()
+adjustGitRepo a = do
+ changeState $ \s -> s { repoadjustment = \r -> repoadjustment s r >>= a }
+ changeGitRepo =<< gitRepo
{- Gets the RemoteGitConfig from a remote, given the Git.Repo for that
- remote. -}
diff --git a/CmdLine/GitAnnex/Options.hs b/CmdLine/GitAnnex/Options.hs
index 81d6434e0..0147c212c 100644
--- a/CmdLine/GitAnnex/Options.hs
+++ b/CmdLine/GitAnnex/Options.hs
@@ -87,9 +87,8 @@ gitAnnexGlobalOptions = commonGlobalOptions ++
where
setnumcopies n = Annex.changeState $ \s -> s { Annex.forcenumcopies = Just $ NumCopies n }
setuseragent v = Annex.changeState $ \s -> s { Annex.useragent = Just v }
- setgitconfig v = inRepo (Git.Config.store v)
- >>= pure . (\r -> r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] })
- >>= Annex.changeGitRepo
+ setgitconfig v = Annex.adjustGitRepo $ \r -> Git.Config.store v $
+ r { gitGlobalOpts = gitGlobalOpts r ++ [Param "-c", Param v] }
setdesktopnotify v = Annex.changeState $ \s -> s { Annex.desktopnotify = Annex.desktopnotify s <> v }
{- Parser that accepts all non-option params. -}
diff --git a/debian/changelog b/debian/changelog
index 8c23e7edb..25ee2b835 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ git-annex (6.20160115) UNRELEASED; urgency=medium
added directly to git due to annex.largefiles configuration.)
(Also done by add --json and import --json)
* registerurl: Check if a remote claims the url, same as addurl does.
+ * Bug fix: Git config settings passed to git-annex -c did not always take
+ effect.
-- Joey Hess <id@joeyh.name> Fri, 15 Jan 2016 14:05:01 -0400