diff options
| author | Vicent Martà <tanoku@gmail.com> | 2012-03-07 00:02:55 +0100 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2012-03-07 00:11:43 +0100 |
| commit | cb8a79617b15e347f26d21cedde0f2b8670c1876 (patch) | |
| tree | 459706192f41bbf15496f0c9bfe2e21b16a7e70b /src/tree.c | |
| parent | 9d160ba85539bbc593369f597a07d42c2770dff4 (diff) | |
| download | libgit2-cb8a79617b15e347f26d21cedde0f2b8670c1876.tar.gz | |
error-handling: Repository
This also includes droping `git_buf_lasterror` because it makes no sense
in the new system. Note that in most of the places were it has been
dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so
instead it should return a generic `-1` and obviously not throw
anything.
Diffstat (limited to 'src/tree.c')
| -rw-r--r-- | src/tree.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/tree.c b/src/tree.c index 19681e3d5..5957f7a61 100644 --- a/src/tree.c +++ b/src/tree.c @@ -569,9 +569,9 @@ int git_treebuilder_write(git_oid *oid, git_repository *repo, git_treebuilder *b git_buf_put(&tree, (char *)entry->oid.id, GIT_OID_RAWSZ); } - if ((error = git_buf_lasterror(&tree)) < GIT_SUCCESS) { + if (git_buf_oom(&tree)) { git_buf_free(&tree); - return git__rethrow(error, "Not enough memory to build the tree data"); + return git__throw(GIT_ENOMEM, "Not enough memory to build the tree data"); } error = git_repository_odb__weakptr(&odb, repo); @@ -720,8 +720,9 @@ static int tree_walk_post( /* append the next entry to the path */ git_buf_puts(path, entry->filename); git_buf_putc(path, '/'); - if ((error = git_buf_lasterror(path)) < GIT_SUCCESS) - break; + + if (git_buf_oom(path)) + return GIT_ENOMEM; error = tree_walk_post(subtree, callback, path, payload); if (error < GIT_SUCCESS) |
