diff options
Diffstat (limited to 'core/save-git.c')
-rw-r--r-- | core/save-git.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/core/save-git.c b/core/save-git.c index 3780399a0..8e5891969 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -1054,16 +1054,19 @@ static int get_authorship(git_repository *repo, git_signature **authorp) if (git_signature_default(authorp, repo) == 0) return 0; #endif - /* Default name information, with potential OS overrides */ - struct user_info user = { - .name = "Subsurface", - .email = "subsurface-app-account@subsurface-divelog.org" - }; - + /* try to fetch the user info from the OS, otherwise use default values. */ + struct user_info user = { .name = NULL, .email = NULL }; subsurface_user_info(&user); + if (!user.name) + user.name = strdup("Subsurface"); + if (!user.email) + user.email = strdup("subsurface-app-account@subsurface-divelog.org"); /* git_signature_default() is too recent */ - return git_signature_now(authorp, user.name, user.email); + int ret = git_signature_now(authorp, user.name, user.email); + free((void *)user.name); + free((void *)user.email); + return ret; } static void create_commit_message(struct membuffer *msg, bool create_empty) |