summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-12-04 21:22:57 -0800
committerRussell Belfer <rb@github.com>2013-12-11 10:57:49 -0800
commitdab89f9b6821b67dd07c8bd4dbb53e25a3e687c7 (patch)
treec7f4f4738dfb249b7534635226128d2e20dac6a5 /src/tree.c
parent96869a4edb2872934e0e167a726ab240f4270fea (diff)
downloadlibgit2-dab89f9b6821b67dd07c8bd4dbb53e25a3e687c7.tar.gz
Further EUSER and error propagation fixes
This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
Diffstat (limited to 'src/tree.c')
-rw-r--r--src/tree.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/tree.c b/src/tree.c
index bb59ff82b..8ded007eb 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -884,14 +884,12 @@ static int tree_walk(
git_vector_foreach(&tree->entries, i, entry) {
if (preorder) {
error = callback(path->ptr, entry, payload);
+ if (error < 0)
+ return giterr_user_cancel();
if (error > 0) {
error = 0;
continue;
}
- if (error < 0) {
- giterr_clear();
- return GIT_EUSER;
- }
}
if (git_tree_entry__is_tree(entry)) {
@@ -918,11 +916,8 @@ static int tree_walk(
git_buf_truncate(path, path_len);
}
- if (!preorder && callback(path->ptr, entry, payload) < 0) {
- giterr_clear();
- error = GIT_EUSER;
- break;
- }
+ if (!preorder && callback(path->ptr, entry, payload) < 0)
+ return giterr_user_cancel();
}
return error;