summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-18 14:12:01 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-18 14:12:01 -0700
commit89ca3c69c1818d988694528a9326be32c0858e3f (patch)
treed3d998660c8dfa54598c12827f21adc38f7f2670
parentbd6e75a49fea11ca96e36c6fa7769bec060110c1 (diff)
downloadsubsurface-89ca3c69c1818d988694528a9326be32c0858e3f.tar.gz
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>
-rw-r--r--save-git.c8
1 files 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)