Hence the function should return "2" in such a case as advertised. Note that finding a directory that busts the depth limit does not mean non directories at the same level would also bust the limit (they don't), so we still need to return 1, not 2 in the within_depth() codepath. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- Nguyen Thai Ngoc Duy <pclouds@xxxxxxxxx> writes: >> When depth check is in effect, the result depends on the mode of the >> entry, so we cannot short-circuit by returning 2, but at least we should >> do so when (max_depth == -1), no? > > Yes, should be 2. Thanks. I'll queue this. tree-walk.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tree-walk.c b/tree-walk.c index 9b43ad5..ece8cc0 100644 --- a/tree-walk.c +++ b/tree-walk.c @@ -560,7 +560,7 @@ int tree_entry_interesting(const struct name_entry *entry, if (!ps->nr) { if (!ps->recursive || ps->max_depth == -1) - return 1; + return 2; return !!within_depth(base->buf + base_offset, baselen, !!S_ISDIR(entry->mode), ps->max_depth); -- 1.7.4.261.g705f2 -- 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