commit: Reword errors
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
diff --git a/src/commit.c b/src/commit.c
index 0d99c0e..bfae059 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);
}