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,13 +1,13 @@
|
|||
{- git-annex assistant environment
|
||||
{- git-annex environment
|
||||
-
|
||||
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
||||
-
|
||||
- Licensed under the GNU GPL version 3 or higher.
|
||||
-}
|
||||
|
||||
module Assistant.Environment where
|
||||
module Annex.Environment where
|
||||
|
||||
import Assistant.Common
|
||||
import Common.Annex
|
||||
import Utility.UserInfo
|
||||
import qualified Git.Config
|
||||
|
||||
|
@ -18,9 +18,14 @@ import System.Posix.Env
|
|||
- 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 "")) $
|
||||
when (gitusername == Nothing || gitusername == Just "") $
|
||||
liftIO checkEnvironmentIO
|
||||
|
||||
checkEnvironmentIO :: IO ()
|
||||
checkEnvironmentIO = do
|
||||
whenM (null <$> myUserGecos) $ do
|
||||
username <- myUserName
|
||||
-- existing environment is not overwritten
|
||||
liftIO $ setEnv "GIT_AUTHOR_NAME" username False
|
||||
setEnv "GIT_AUTHOR_NAME" username False
|
||||
setEnv "GIT_COMMITTER_NAME" username False
|
|
@ -154,7 +154,6 @@ import Assistant.Threads.XMPPClient
|
|||
#warning Building without the webapp. You probably need to install Yesod..
|
||||
import Assistant.Types.UrlRenderer
|
||||
#endif
|
||||
import Assistant.Environment
|
||||
import qualified Utility.Daemon
|
||||
import Utility.LogFile
|
||||
import Utility.ThreadScheduler
|
||||
|
@ -198,8 +197,6 @@ startDaemon assistant foreground listenhost startbrowser = do
|
|||
| otherwise = "watch"
|
||||
start daemonize webappwaiter = withThreadState $ \st -> do
|
||||
checkCanWatch
|
||||
when assistant
|
||||
checkEnvironment
|
||||
dstatus <- startDaemonStatus
|
||||
logfile <- fromRepo gitAnnexLogFile
|
||||
liftIO $ debugM desc $ "logging to " ++ logfile
|
||||
|
|
|
@ -24,6 +24,7 @@ import qualified Git
|
|||
import qualified Git.AutoCorrect
|
||||
import Annex.Content
|
||||
import Annex.Ssh
|
||||
import Annex.Environment
|
||||
import Command
|
||||
|
||||
type Params = [String]
|
||||
|
@ -39,6 +40,7 @@ dispatch fuzzyok allargs allcmds commonoptions fields header getgitrepo = do
|
|||
Right g -> do
|
||||
state <- Annex.new g
|
||||
(actions, state') <- Annex.run state $ do
|
||||
checkEnvironment
|
||||
checkfuzzy
|
||||
forM_ fields $ uncurry Annex.setField
|
||||
sequence_ flags
|
||||
|
|
|
@ -15,6 +15,7 @@ import Assistant.NamedThread
|
|||
import Assistant.Threads.WebApp
|
||||
import Assistant.WebApp
|
||||
import Assistant.Install
|
||||
import Annex.Environment
|
||||
import Utility.WebApp
|
||||
import Utility.Daemon (checkDaemon)
|
||||
import Init
|
||||
|
@ -111,6 +112,7 @@ startNoRepo = do
|
|||
-}
|
||||
firstRun :: Maybe HostName -> IO ()
|
||||
firstRun listenhost = do
|
||||
checkEnvironmentIO
|
||||
{- Without a repository, we cannot have an Annex monad, so cannot
|
||||
- get a ThreadState. Using undefined is only safe because the
|
||||
- webapp checks its noAnnex field before accessing the
|
||||
|
|
4
debian/changelog
vendored
4
debian/changelog
vendored
|
@ -9,6 +9,10 @@ git-annex (4.20130418) UNRELEASED; urgency=low
|
|||
* sync, assistant: Sync with remotes that have annex-ignore set,
|
||||
so that git remotes on servers without git-annex installed can be used
|
||||
to keep clients' git repos in sync.
|
||||
* 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.
|
||||
|
||||
-- Joey Hess <joeyh@debian.org> Thu, 18 Apr 2013 16:22:48 -0400
|
||||
|
||||
|
|
|
@ -35,3 +35,7 @@ remote repository always fails**
|
|||
> So, I'm going to repurpose this bug to track that problem. --[[Joey]]
|
||||
|
||||
[[!meta title="assistant can fail to make git repository if remote server is lacking GECOS"]]
|
||||
|
||||
>> [[done]]; git-annex always checks for missing gecos and enables
|
||||
>> a workaround. This does mean the server needs to be upgraded in order
|
||||
>> for the fix to work. --[[Joey]]
|
||||
|
|
Loading…
Reference in a new issue