Windows: Fix crash when user.name is not set in git config.
This commit is contained in:
parent
8c622ec100
commit
0f6aaf8012
5 changed files with 18 additions and 22 deletions
|
@ -32,7 +32,7 @@ checkEnvironment = do
|
||||||
liftIO checkEnvironmentIO
|
liftIO checkEnvironmentIO
|
||||||
|
|
||||||
checkEnvironmentIO :: IO ()
|
checkEnvironmentIO :: IO ()
|
||||||
checkEnvironmentIO = whenM (null <$> myUserGecos) $ do
|
checkEnvironmentIO = whenM (isNothing <$> myUserGecos) $ do
|
||||||
username <- myUserName
|
username <- myUserName
|
||||||
ensureEnv "GIT_AUTHOR_NAME" username
|
ensureEnv "GIT_AUTHOR_NAME" username
|
||||||
ensureEnv "GIT_COMMITTER_NAME" username
|
ensureEnv "GIT_COMMITTER_NAME" username
|
||||||
|
|
|
@ -40,11 +40,12 @@ myUserName = myVal env userName
|
||||||
env = ["USERNAME", "USER", "LOGNAME"]
|
env = ["USERNAME", "USER", "LOGNAME"]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myUserGecos :: IO String
|
myUserGecos :: IO (Maybe String)
|
||||||
#ifdef __ANDROID__
|
-- userGecos crashes on Android and is not available on Windows.
|
||||||
myUserGecos = return "" -- userGecos crashes on Android
|
#if defined(__ANDROID__) || defined(mingw32_HOST_OS)
|
||||||
|
myUserGecos = return Nothing
|
||||||
#else
|
#else
|
||||||
myUserGecos = myVal [] userGecos
|
myUserGecos = Just <$> myVal [] userGecos
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
myVal :: [String] -> (UserEntry -> String) -> IO String
|
myVal :: [String] -> (UserEntry -> String) -> IO String
|
||||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
||||||
|
git-annex (5.20141025) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
|
* Windows: Fix crash when user.name is not set in git config.
|
||||||
|
|
||||||
|
-- Joey Hess <joeyh@debian.org> Fri, 31 Oct 2014 16:13:43 -0400
|
||||||
|
|
||||||
git-annex (5.20141024) unstable; urgency=medium
|
git-annex (5.20141024) unstable; urgency=medium
|
||||||
|
|
||||||
* vicfg: Deleting configurations now resets to the default, where
|
* vicfg: Deleting configurations now resets to the default, where
|
||||||
|
|
|
@ -20,3 +20,9 @@ Running Windows 7, x64. Also tried running as administrator and in a cmd.exe she
|
||||||
### Please provide any additional information below.
|
### Please provide any additional information below.
|
||||||
|
|
||||||
The `git annex test` command does work, and all 84 tests passes.
|
The `git annex test` command does work, and all 84 tests passes.
|
||||||
|
|
||||||
|
> [[fixed|done]]; I was able to reproduce this bug, and it was crashing
|
||||||
|
> trying to look up the geckos username. I don't understand why this worked
|
||||||
|
> before; some change exposed this code path on Windows. In any case, I've
|
||||||
|
> fixed the crash, and I will be updating the windows builds with this bug
|
||||||
|
> fix. --[[Joey]]
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
[[!comment format=mdwn
|
|
||||||
username="joey"
|
|
||||||
subject="""comment 1"""
|
|
||||||
date="2014-10-31T16:57:05Z"
|
|
||||||
content="""
|
|
||||||
This code path should only be called when USERPROFILE or
|
|
||||||
one of USERNAME/USER/LOGNAME is not set. Which should not usually be the case
|
|
||||||
when using git-annex on windows.
|
|
||||||
|
|
||||||
However, since we know that won't work on Windows it might as well not even
|
|
||||||
try.. So I've made it instead print an error that indicates which
|
|
||||||
environment variables need to be set.
|
|
||||||
|
|
||||||
Can you please download the windows daily build from
|
|
||||||
<http://git-annex.branchable.com/install/windows>, and see what this new,
|
|
||||||
better error message says?
|
|
||||||
"""]]
|
|
Loading…
Add table
Reference in a new issue