summaryrefslogtreecommitdiff
path: root/src/tree.c
diff options
context:
space:
mode:
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;