When init detects that git is not configured to commit, and sets user.email to work around the problem, also make it set user.name.

I was able to reproduce git failing to commit despite user.email being set,
in a test account on my laptop. The account had no GECOS information.
This commit is contained in:
Joey Hess 2014-04-20 14:17:57 -04:00
parent c70a762e81
commit a8bd7a607d
2 changed files with 6 additions and 2 deletions

View file

@ -56,10 +56,12 @@ checkEnvironmentIO =
#endif #endif
{- Runs an action that commits to the repository, and if it fails, {- Runs an action that commits to the repository, and if it fails,
- sets user.email to a dummy value and tries the action again. -} - sets user.email and user.name to a dummy value and tries the action again. -}
ensureCommit :: Annex a -> Annex a ensureCommit :: Annex a -> Annex a
ensureCommit a = either retry return =<< tryAnnex a ensureCommit a = either retry return =<< tryAnnex a
where where
retry _ = do retry _ = do
setConfig (ConfigKey "user.email") =<< liftIO myUserName name <- liftIO myUserName
setConfig (ConfigKey "user.name") name
setConfig (ConfigKey "user.email") name
a a

2
debian/changelog vendored
View file

@ -30,6 +30,8 @@ git-annex (5.20140413) UNRELEASED; urgency=medium
~/.config/git-annex/autostart but no longer has a git repository in it. ~/.config/git-annex/autostart but no longer has a git repository in it.
* findref: New command, like find but shows files in a specified git ref. * findref: New command, like find but shows files in a specified git ref.
* webapp: Fix UI for removing XMPP connection. * webapp: Fix UI for removing XMPP connection.
* When init detects that git is not configured to commit, and sets
user.email to work around the problem, also make it set user.name.
-- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400 -- Joey Hess <joeyh@debian.org> Fri, 11 Apr 2014 21:33:35 -0400