summaryrefslogtreecommitdiffstats
path: root/core/save-git.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-10 17:19:51 -0700
committerGravatar GitHub <noreply@github.com>2020-04-10 17:19:51 -0700
commit61f9c4114e076e77f75db48611283209b33e4202 (patch)
tree5d959c312b5d6651e16c8cca0c5c80b1f032ee72 /core/save-git.c
parent42c974edd73b48520a5f0d4579510c39a56902c5 (diff)
parent53fb533a99eef94d5df1a5258bc23ec123f59d6d (diff)
downloadsubsurface-61f9c4114e076e77f75db48611283209b33e4202.tar.gz
Merge pull request #2737 from Subsurface-divelog/libgitCleanup
Libgit cleanup
Diffstat (limited to 'core/save-git.c')
-rw-r--r--core/save-git.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/core/save-git.c b/core/save-git.c
index 2b6b7c29a..2d58f931a 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -1021,25 +1021,18 @@ int update_git_checkout(git_repository *repo, git_object *parent, git_tree *tree
return git_checkout_tree(repo, (git_object *) tree, &opts);
}
-static int get_authorship(git_repository *repo, git_signature **authorp)
+int get_authorship(git_repository *repo, git_signature **authorp)
{
-#if LIBGIT2_VER_MAJOR || LIBGIT2_VER_MINOR >= 20
if (git_signature_default(authorp, repo) == 0)
return 0;
+
+#ifdef SUBSURFACE_MOBILE
+#define APPNAME "Subsurface-mobile"
+#else
+#define APPNAME "Subsurface"
#endif
- /* 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)
- user.name = strdup("Subsurface");
- if (!user.email)
- user.email = strdup("subsurface-app-account@subsurface-divelog.org");
-
- /* git_signature_default() is too recent */
- int ret = git_signature_now(authorp, user.name, user.email);
- free((void *)user.name);
- free((void *)user.email);
- return ret;
+ return git_signature_now(authorp, APPNAME, "subsurface-app-account@subsurface-divelog.org");
+#undef APPNAME
}
static void create_commit_message(struct membuffer *msg, bool create_empty)