aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-04-22 15:36:34 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-04-22 15:36:34 -0400
commit6c5360cbdf20821a97a0f109ea114e4772b001e6 (patch)
tree030a5613938276edb57e18a09063bfe4c4ed4905
parent8655ea7f8e853b7de4defbca2655b741362ecd21 (diff)
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.
-rw-r--r--Annex/Environment.hs (renamed from Assistant/Environment.hs)19
-rw-r--r--Assistant.hs3
-rw-r--r--CmdLine.hs2
-rw-r--r--Command/WebApp.hs2
-rw-r--r--debian/changelog4
-rw-r--r--doc/bugs/Adding_second_remote_repository_over_ssh_fails.mdwn4
6 files changed, 24 insertions, 10 deletions
diff --git a/Assistant/Environment.hs b/Annex/Environment.hs
index 3153fcfe5..357ad6958 100644
--- a/Assistant/Environment.hs
+++ b/Annex/Environment.hs
@@ -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
diff --git a/Assistant.hs b/Assistant.hs
index 92cc275b5..e24614517 100644
--- a/Assistant.hs
+++ b/Assistant.hs
@@ -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
diff --git a/CmdLine.hs b/CmdLine.hs
index 63d36c74c..050f119f1 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -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
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index 90abd4d27..0e0756901 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -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
diff --git a/debian/changelog b/debian/changelog
index 86500c6f8..c0cba45ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/bugs/Adding_second_remote_repository_over_ssh_fails.mdwn b/doc/bugs/Adding_second_remote_repository_over_ssh_fails.mdwn
index 7b449f421..abb5226be 100644
--- a/doc/bugs/Adding_second_remote_repository_over_ssh_fails.mdwn
+++ b/doc/bugs/Adding_second_remote_repository_over_ssh_fails.mdwn
@@ -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]]