Commit d91d2968 by Nika Layzell

mailmap: Hide EEXISTS to simplify git_mailmap_add_entry callers

parent c1a85ae2
......@@ -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,
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment