mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:16:16 +00:00
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>
This commit is contained in:
parent
bd6e75a49f
commit
89ca3c69c1
1 changed files with 4 additions and 4 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue