diff options
| author | Jakob Pfender <jpfender@elegosoft.com> | 2011-05-19 15:10:54 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2011-05-23 21:38:39 +0300 |
| commit | bc06a4eeecbda3b23aad53cbf0ea20e8a25f3931 (patch) | |
| tree | fb4d5b9ae494754dd86f7e235eb886f9db6fcda4 /src/tree.c | |
| parent | 6e34ee61bcb7c5c679d84b815d78aad99ed21c9b (diff) | |
| download | libgit2-bc06a4eeecbda3b23aad53cbf0ea20e8a25f3931.tar.gz | |
tree.c: Move to new error handling mechanism
Diffstat (limited to 'src/tree.c')
| -rw-r--r-- | src/tree.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tree.c b/src/tree.c index 6f9fc8607..60413e276 100644 --- a/src/tree.c +++ b/src/tree.c @@ -175,7 +175,7 @@ static int tree_parse_buffer(git_tree *tree, const char *buffer, const char *buf buffer += GIT_OID_RAWSZ; } - return error; + return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to parse buffer"); } int git_tree__parse(git_tree *tree, git_odb_object *obj) @@ -266,7 +266,7 @@ static int write_index(git_oid *oid, git_index *index, const char *base, int bas error = git_odb_write(oid, index->repository->db, buffer, offset, GIT_OBJ_TREE); free(buffer); - return (error == GIT_SUCCESS) ? nr : error; + return (error == GIT_SUCCESS) ? nr : git__rethrow(error, "Failed to write index"); } int git_tree_create_fromindex(git_oid *oid, git_index *index) @@ -277,7 +277,7 @@ int git_tree_create_fromindex(git_oid *oid, git_index *index) return git__throw(GIT_EBAREINDEX, "Failed to create tree. The index file is not backed up by an existing repository"); error = write_index(oid, index, "", 0, 0, git_index_entrycount(index)); - return (error < GIT_SUCCESS) ? error : GIT_SUCCESS; + return (error < GIT_SUCCESS) ? git__rethrow(error, "Failed to create tree") : GIT_SUCCESS; } static void sort_entries(git_treebuilder *bld) @@ -448,7 +448,7 @@ int git_treebuilder_write(git_oid *oid, git_repository *repo, git_treebuilder *b error = stream->finalize_write(oid, stream); stream->free(stream); - return error; + return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to write tree"); } void git_treebuilder_filter(git_treebuilder *bld, int (*filter)(const git_tree_entry *, void *), void *payload) |
