diff options
Diffstat (limited to 'Annex')
-rw-r--r-- | Annex/Environment.hs | 4 | ||||
-rw-r--r-- | Annex/Init.hs | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/Annex/Environment.hs b/Annex/Environment.hs index a066e9ab0..4f0fda986 100644 --- a/Annex/Environment.hs +++ b/Annex/Environment.hs @@ -33,7 +33,7 @@ checkEnvironment = do checkEnvironmentIO :: IO () checkEnvironmentIO = whenM (isNothing <$> myUserGecos) $ do - username <- myUserName + username <- either (const "unknown") id <$> myUserName ensureEnv "GIT_AUTHOR_NAME" username ensureEnv "GIT_COMMITTER_NAME" username where @@ -52,7 +52,7 @@ ensureCommit :: Annex a -> Annex a ensureCommit a = either retry return =<< tryNonAsync a where retry _ = do - name <- liftIO myUserName + name <- liftIO $ either (const "unknown") id <$> myUserName setConfig (ConfigKey "user.name") name setConfig (ConfigKey "user.email") name a diff --git a/Annex/Init.hs b/Annex/Init.hs index e12a8bc80..08dd91a71 100644 --- a/Annex/Init.hs +++ b/Annex/Init.hs @@ -52,13 +52,11 @@ genDescription (Just d) = return d genDescription Nothing = do reldir <- liftIO . relHome =<< liftIO . absPath =<< fromRepo Git.repoPath hostname <- fromMaybe "" <$> liftIO getHostname -#ifndef mingw32_HOST_OS let at = if null hostname then "" else "@" - username <- liftIO myUserName - return $ concat [username, at, hostname, ":", reldir] -#else - return $ concat [hostname, ":", reldir] -#endif + v <- liftIO myUserName + return $ concat $ case v of + Right username -> [username, at, hostname, ":", reldir] + Left _ -> [hostname, ":", reldir] initialize :: Maybe String -> Maybe Version -> Annex () initialize mdescription mversion = do |