Revert "override rather than setting user.name and user.email"
This reverts commit 66eb63dd82
.
git-annex init is the only thing that uses ensureCommit. So overriding
there will make later commits to the git-annex branch or by git-annex sync
fail.
It's ugly that git-annex init sets user.name and user.email, but it only
does it on systems that are badly configured.
This commit is contained in:
parent
e91bf784cd
commit
e3f5bd4ca6
2 changed files with 9 additions and 8 deletions
|
@ -1,6 +1,6 @@
|
||||||
{- git-annex environment
|
{- git-annex environment
|
||||||
-
|
-
|
||||||
- Copyright 2012-2023 Joey Hess <id@joeyh.name>
|
- Copyright 2012, 2013 Joey Hess <id@joeyh.name>
|
||||||
-
|
-
|
||||||
- Licensed under the GNU AGPL version 3 or higher.
|
- Licensed under the GNU AGPL version 3 or higher.
|
||||||
-}
|
-}
|
||||||
|
@ -14,9 +14,9 @@ module Annex.Environment (
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Annex.Common
|
import Annex.Common
|
||||||
import qualified Annex
|
|
||||||
import Utility.UserInfo
|
import Utility.UserInfo
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
|
import Config
|
||||||
import Utility.Env.Set
|
import Utility.Env.Set
|
||||||
|
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
@ -48,8 +48,11 @@ checkEnvironmentIO = whenM (isNothing <$> myUserGecos) $ do
|
||||||
ensureEnv var val = setEnv var val False
|
ensureEnv var val = setEnv var val False
|
||||||
|
|
||||||
{- Runs an action that commits to the repository, and if it fails,
|
{- Runs an action that commits to the repository, and if it fails,
|
||||||
- overrides user.email and user.name to a dummy value and tries
|
- sets user.email and user.name to a dummy value and tries the action again.
|
||||||
- the action again. -}
|
-
|
||||||
|
- Note that user.email and user.name are left set afterwards, so this only
|
||||||
|
- needs to be used once to make sure that future commits will succeed.
|
||||||
|
-}
|
||||||
ensureCommit :: Annex a -> Annex a
|
ensureCommit :: Annex a -> Annex a
|
||||||
ensureCommit a = either retry return =<< tryNonAsync a
|
ensureCommit a = either retry return =<< tryNonAsync a
|
||||||
where
|
where
|
||||||
|
@ -57,8 +60,8 @@ ensureCommit a = either retry return =<< tryNonAsync a
|
||||||
( liftIO (throwIO e)
|
( liftIO (throwIO e)
|
||||||
, do
|
, do
|
||||||
name <- liftIO $ either (const "unknown") id <$> myUserName
|
name <- liftIO $ either (const "unknown") id <$> myUserName
|
||||||
Annex.addGitConfigOverride ("user.name=" ++ name)
|
setConfig "user.name" name
|
||||||
Annex.addGitConfigOverride ("user.email=" ++ name)
|
setConfig "user.email" name
|
||||||
a
|
a
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ git-annex (10.20230330) UNRELEASED; urgency=medium
|
||||||
* Sped up sqlite inserts 2x when built with persistent 2.14.5.0
|
* Sped up sqlite inserts 2x when built with persistent 2.14.5.0
|
||||||
* Fix laziness bug introduced in last release that breaks use
|
* Fix laziness bug introduced in last release that breaks use
|
||||||
of --unlock-present and --hide-missing adjusted branches.
|
of --unlock-present and --hide-missing adjusted branches.
|
||||||
* Avoid setting user.name and user.email in the git config
|
|
||||||
when git is unable to detect them.
|
|
||||||
* Support user.useConfigOnly git config.
|
* Support user.useConfigOnly git config.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Fri, 31 Mar 2023 12:48:54 -0400
|
-- Joey Hess <id@joeyh.name> Fri, 31 Mar 2023 12:48:54 -0400
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue