diff options
| -rw-r--r-- | include/git2/mailmap.h | 2 | ||||
| -rw-r--r-- | src/mailmap.c | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/include/git2/mailmap.h b/include/git2/mailmap.h index b22a00c67..c6ed4811f 100644 --- a/include/git2/mailmap.h +++ b/include/git2/mailmap.h @@ -47,7 +47,7 @@ GIT_EXTERN(void) git_mailmap_free(git_mailmap *mm); * @param real_email the real email to use, or NULL * @param replace_name the name to replace, or NULL * @param replace_email the email to replace - * @return 0 if it was added, EEXISTS if it replaced an entry, or an error code + * @return 0 on success, or an error code */ GIT_EXTERN(int) git_mailmap_add_entry( git_mailmap *mm, const char *real_name, const char *real_email, diff --git a/src/mailmap.c b/src/mailmap.c index e4b924c05..f249c5261 100644 --- a/src/mailmap.c +++ b/src/mailmap.c @@ -203,7 +203,9 @@ static int mailmap_add_entry_unterminated( GITERR_CHECK_ALLOC(entry->replace_email); error = git_vector_insert_sorted(&mm->entries, entry, mailmap_entry_replace); - if (error < 0 && error != GIT_EEXISTS) + if (error == GIT_EEXISTS) + error = GIT_OK; + else if (error < 0) mailmap_entry_free(entry); return error; @@ -256,7 +258,7 @@ int git_mailmap_add_buffer(git_mailmap *mm, const char *buf, size_t len) error = mailmap_add_entry_unterminated( mm, real_name.ptr, real_name.size, real_email.ptr, real_email.size, replace_name.ptr, replace_name.size, replace_email.ptr, replace_email.size); - if (error < 0 && error != GIT_EEXISTS) + if (error < 0) goto cleanup; error = 0; |
