From 89ca3c69c1818d988694528a9326be32c0858e3f Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 18 Jun 2015 14:12:01 -0700 Subject: [PATCH] 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 --- save-git.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/save-git.c b/save-git.c index f4abcb080..7c564e533 100644 --- a/save-git.c +++ b/save-git.c @@ -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)