Commit 53ae12359d324890c4d30cc06bd2631ebdec43bb

Carlos Martín Nieto 2012-08-13T14:00:53

tree: bring back the documented behaviour for a walk However, there should be a way to cancel the walk and another to skip the entry.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/tree.c b/src/tree.c
index e5858b5..911cbad 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -787,10 +787,8 @@ static int tree_walk(
 	for (i = 0; i < tree->entries.length; ++i) {
 		git_tree_entry *entry = tree->entries.contents[i];
 
-		if (preorder && callback(path->ptr, entry, payload)) {
-			error = GIT_EUSER;
-			break;
-		}
+		if (preorder && callback(path->ptr, entry, payload) < 0)
+			continue
 
 		if (git_tree_entry__is_tree(entry)) {
 			git_tree *subtree;