Git storage: don't abort if there is no default user/email set

I never ran into this because all of my computers have a global default
set for my name and email address. But if the user never uses git and has
no global settings there will be no such info. Instead of failing we need
to just set up a default ID and then try to get a best guess from the OS
(just as we used to do before libgit2 supported getting the git settings
for authorship).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-06-18 14:12:01 -07:00
parent bd6e75a49f
commit 89ca3c69c1

View file

@ -978,19 +978,19 @@ static int update_git_checkout(git_repository *repo, git_object *parent, git_tre
static int get_authorship(git_repository *repo, git_signature **authorp)
{
#if LIBGIT2_VER_MAJOR || LIBGIT2_VER_MINOR >= 20
return git_signature_default(authorp, repo);
#else
if (git_signature_default(authorp, repo) == 0)
return 0;
#endif
/* Default name information, with potential OS overrides */
struct user_info user = {
.name = "Subsurface",
.email = "subsurace@hohndel.org"
.email = "subsurace@subsurface-divelog.org"
};
subsurface_user_info(&user);
/* git_signature_default() is too recent */
return git_signature_now(authorp, user.name, user.email);
#endif
}
static void create_commit_message(struct membuffer *msg)