rename changeGitConfig to overrideGitConfig and avoid unncessary calls

It's important that it be clear that it overrides a config, such that
reloading the git config won't change it, and in particular, setConfig
won't change it.

Most of the calls to changeGitConfig were actually after setConfig,
which was redundant and unncessary. So removed those.

The only remaining one, besides --debug, is in the handling of
repository-global config values. That one's ok, because the
way mergeGitConfig is implemented, it does not override any value that
is set in git config. If a value with a repo-global setting was passed
to setConfig, it would set it in the git config, reload the git config,
re-apply mergeGitConfig, and use the newly set value, which is the right
thing.
This commit is contained in:
Joey Hess 2020-02-27 01:06:35 -04:00
parent c089f395b0
commit c78b9b55b6
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 9 additions and 16 deletions

View file

@ -10,7 +10,6 @@
module Upgrade.V5 where
import Annex.Common
import qualified Annex
import Config
import Config.Smudge
import Annex.InodeSentinal
@ -84,7 +83,6 @@ convertDirect = do
- space, with less preservation of old versions of files
- as does annex.thin. -}
setConfig (annexConfig "thin") (boolConfig True)
Annex.changeGitConfig $ \c -> c { annexThin = True }
Direct.setIndirect
cur <- fromMaybe (error "Somehow no branch is checked out")
<$> inRepo Git.Branch.current

View file

@ -19,7 +19,6 @@ module Upgrade.V5.Direct (
) where
import Annex.Common
import qualified Annex
import qualified Git
import qualified Git.Config
import qualified Git.Ref
@ -35,7 +34,6 @@ setIndirect = do
setbare
switchHEADBack
setConfig (annexConfig "direct") val
Annex.changeGitConfig $ \c -> c { annexDirect = False }
where
val = Git.Config.boolConfig False
coreworktree = ConfigKey "core.worktree"