Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- builtin-ls-files.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/builtin-ls-files.c b/builtin-ls-files.c index 2bb851a..e16638e 100644 --- a/builtin-ls-files.c +++ b/builtin-ls-files.c @@ -51,6 +51,17 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent) if (!match_pathspec(pathspec, ent->name, ent->len, len, ps_matched)) return; + if (max_depth) { + int slashes = 0; + const char *entry = ent->name + prefix_offset; + while ((entry = strchr(entry, '/')) != NULL) { + slashes++; + if (slashes >= max_depth) + return; + entry++; + } + } + fputs(tag, stdout); write_name_quoted(ent->name + offset, stdout, line_terminator); } -- 1.6.6.315.g1a406 -- 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