The variable name ret sounds like the variable to be returned, but since e6c111b4 we return error. Hence the variable name is miss leading. As this variable is used only to extract the bits from the callback of a tree object, trees_used is a better name. Also the assignment to 0 was removed at the start of the function as well after the if(interesting) block. Those were unneeded as that variable is set to the callback return value any time we enter the if(interesting) block, so we'd overwrite old values anyway. Helped-by: Junio C Hamano <gitster@xxxxxxxxx> Signed-off-by: Stefan Beller <stefanbeller@xxxxxxxxxxxxxx> --- tree-walk.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tree-walk.c b/tree-walk.c index c366852..5ece8c3 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -324,7 +324,6 @@ static inline int prune_traversal(struct name_entry *e, int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info) { - int ret = 0; int error = 0; struct name_entry *entry = xmalloc(n*sizeof(*entry)); int i; @@ -342,6 +341,7 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info) strbuf_setlen(&base, info->pathlen); } for (;;) { + int trees_used; unsigned long mask, dirmask; const char *first = NULL; int first_len = 0; @@ -405,15 +405,14 @@ int traverse_trees(int n, struct tree_desc *t, struct traverse_info *info) if (interesting < 0) break; if (interesting) { - ret = info->fn(n, mask, dirmask, entry, info); - if (ret < 0) { - error = ret; + trees_used = info->fn(n, mask, dirmask, entry, info); + if (trees_used < 0) { + error = trees_used; if (!info->show_all_errors) break; } - mask &= ret; + mask &= trees_used; } - ret = 0; for (i = 0; i < n; i++) if (mask & (1ul << i)) update_extended_entry(tx + i, entry + i); -- 1.8.3.3.754.g9c3c367.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html