Detect systems that have no user name set in GECOS, and also don't have user.name set in git config, and put in a workaround so that commits to the git-annex branch (and the assistant) will still succeed despite git not liking the system configuration.
This commit is contained in:
parent
8861e270be
commit
9cb223a8b3
6 changed files with 24 additions and 10 deletions
|
@ -1,26 +0,0 @@
|
|||
{- git-annex assistant environment
|
||||
-
|
||||
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Assistant.Environment where
|
||||
|
||||
import Assistant.Common
|
||||
import Utility.UserInfo
|
||||
import qualified Git.Config
|
||||
|
||||
import System.Posix.Env
|
||||
|
||||
{- Checks that the system's environment allows git to function.
|
||||
- Git requires a GECOS username, or suitable git configuration, or
|
||||
- environment variables. -}
|
||||
checkEnvironment :: Annex ()
|
||||
checkEnvironment = do
|
||||
username <- liftIO myUserName
|
||||
gecos <- liftIO myUserGecos
|
||||
gitusername <- fromRepo $ Git.Config.getMaybe "user.name"
|
||||
when (null gecos && (gitusername == Nothing || gitusername == Just "")) $
|
||||
-- existing environment is not overwritten
|
||||
liftIO $ setEnv "GIT_AUTHOR_NAME" username False
|
Loading…
Add table
Add a link
Reference in a new issue