diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-04-09 17:03:43 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-04-09 17:05:44 -0700 |
commit | 7a238b614685ce7d85b1a7564871e72c960bad89 (patch) | |
tree | c26660bce37d2912df3533a13ace7d1e9589789b /core/save-git.c | |
parent | 67a717dc057a5936ae1f5820fc6c470524213b97 (diff) | |
download | subsurface-7a238b614685ce7d85b1a7564871e72c960bad89.tar.gz |
cloud-storage: simplify creation of git authorship
While having the local user information in the repo on Linux seemed
clever when we implemented it, it's inconsistent with all the other
platforms. Let's just not do that unless the user has indeed set
a global name/email pair for git.
Instead indicate if this was Subsurface or Subsurface-mobile.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/save-git.c')
-rw-r--r-- | core/save-git.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/core/save-git.c b/core/save-git.c index 7bf7b2e1d..e3564eea7 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -1024,19 +1024,14 @@ static int get_authorship(git_repository *repo, git_signature **authorp) { if (git_signature_default(authorp, repo) == 0) return 0; - /* 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; + +#ifdef SUBSURFACE_MOBILE +#define APPNAME "Subsurface-mobile" +#else +#define APPNAME "Subsurface" +#endif + 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) |