Commit 4c7a5e9e3f85a5a823cf66c769e502163f1d5e4e

Vicent Marti 2011-05-23T20:36:06

commit: Reword errors

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);
 }