Commit 236945a5 by Russell Belfer

Merge pull request #1849 from whavinga/treewalker

Treewalker
parents 25803c63 d7fc2eb2
...@@ -881,8 +881,10 @@ static int tree_walk( ...@@ -881,8 +881,10 @@ static int tree_walk(
git_vector_foreach(&tree->entries, i, entry) { git_vector_foreach(&tree->entries, i, entry) {
if (preorder) { if (preorder) {
error = callback(path->ptr, entry, payload); error = callback(path->ptr, entry, payload);
if (error > 0) if (error > 0) {
error = 0;
continue; continue;
}
if (error < 0) { if (error < 0) {
giterr_clear(); giterr_clear();
return GIT_EUSER; return GIT_EUSER;
...@@ -905,11 +907,12 @@ static int tree_walk( ...@@ -905,11 +907,12 @@ static int tree_walk(
return -1; return -1;
error = tree_walk(subtree, callback, path, payload, preorder); error = tree_walk(subtree, callback, path, payload, preorder);
git_tree_free(subtree);
if (error != 0) if (error != 0)
break; break;
git_buf_truncate(path, path_len); git_buf_truncate(path, path_len);
git_tree_free(subtree);
} }
if (!preorder && callback(path->ptr, entry, payload) < 0) { if (!preorder && callback(path->ptr, entry, payload) < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment