diff --git a/src/commit.c b/src/commit.c index 0d99c0ef3..bfae0592e 100644 --- a/src/commit.c +++ b/src/commit.c @@ -103,8 +103,6 @@ int git_commit_create_v( free((void *)oids); - if (error < GIT_SUCCESS) - return git__rethrow(error, "Failed to create commit"); return error; } @@ -137,8 +135,6 @@ int git_commit_create_ov( free((void *)oids); - if (error < GIT_SUCCESS) - return git__rethrow(error, "Failed to create commit"); return error; } @@ -168,8 +164,6 @@ int git_commit_create_o( free((void *)oids); - if (error < GIT_SUCCESS) - return git__rethrow(error, "Failed to create commit"); return error; } @@ -197,7 +191,7 @@ int git_commit_create( committer_length = git_signature__write(&committer_str, "committer", committer); if (author_length < 0 || committer_length < 0) - return GIT_ENOMEM; + return git__throw(GIT_EINVALIDARGS, "Cannot create commit. Failed to parse signature"); final_size += GIT_OID_LINE_LENGTH("tree"); final_size += GIT_OID_LINE_LENGTH("parent") * parent_count; @@ -252,7 +246,8 @@ int git_commit_create( if (error < GIT_SUCCESS) return git__rethrow(error, "Failed to create commit"); - return error; + + return GIT_SUCCESS; } int commit_parse_buffer(git_commit *commit, const void *data, size_t len) @@ -354,7 +349,7 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n) parent_oid = git_vector_get(&commit->parent_oids, n); if (parent_oid == NULL) - return git__throw(GIT_ENOTFOUND, "Failed to get parent. Parent does not exist"); + return git__throw(GIT_ENOTFOUND, "Parent %u does not exist", n); return git_commit_lookup(parent, commit->object.repo, parent_oid); }