On Wed, Mar 26, 2014 at 9:48 AM, Nguyễn Thái Ngọc Duy <pclo...@gmail.com> wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com> > --- > Documentation/git-ls-files.txt | 7 +++++++ > builtin/ls-files.c | 7 +++++++ > 2 files changed, 14 insertions(+) > > diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt > index cd52461..3c022eb 100644 > --- a/Documentation/git-ls-files.txt > +++ b/Documentation/git-ls-files.txt > @@ -162,6 +162,13 @@ a space) at the start of each line: > for option syntax.`--column` and `--no-column` without options > are equivalent to 'always' and 'never' respectively. > > +--max-depth <depth>::
Other options in this file are documented as: --max-depth=<depth>:: > + For each <pathspec> given on command line, descend at most <depth> > + levels of directories. A negative value means no limit. > + This option is ignored if <pathspec> contains active wildcards. > + In other words if "a*" matches a directory named "a*", > + "*" is matched literally so --max-depth is still effective. Would it be worthwhile to mention the default? > + > \--:: > Do not interpret any more arguments as options. > > diff --git a/builtin/ls-files.c b/builtin/ls-files.c > index 335d3b0..8eef423 100644 > --- a/builtin/ls-files.c > +++ b/builtin/ls-files.c > @@ -503,6 +503,7 @@ static int option_parse_exclude_standard(const struct > option *opt, > int cmd_ls_files(int argc, const char **argv, const char *cmd_prefix) > { > int require_work_tree = 0, show_tag = 0, i; > + int max_depth = -1; > const char *max_prefix; > struct dir_struct dir; > struct exclude_list *el; > @@ -560,6 +561,9 @@ int cmd_ls_files(int argc, const char **argv, const char > *cmd_prefix) > N_("pretend that paths removed since <tree-ish> are > still present")), > OPT__COLOR(&use_color, N_("show color")), > OPT_COLUMN(0, "column", &colopts, N_("show files in > columns")), > + { OPTION_INTEGER, 0, "max-depth", &max_depth, N_("depth"), > + N_("descend at most <depth> levels"), PARSE_OPT_NONEG, > + NULL, 1 }, > OPT__ABBREV(&abbrev), > OPT_BOOL(0, "debug", &debug_mode, N_("show debugging data")), > OPT_END() > @@ -624,8 +628,11 @@ int cmd_ls_files(int argc, const char **argv, const char > *cmd_prefix) > > parse_pathspec(&pathspec, 0, > PATHSPEC_PREFER_CWD | > + (max_depth != -1 ? PATHSPEC_MAXDEPTH_VALID : 0) | > PATHSPEC_STRIP_SUBMODULE_SLASH_CHEAP, > prefix, argv); > + pathspec.max_depth = max_depth; > + pathspec.recursive = 1; > > /* Find common prefix for all pathspec's */ > max_prefix = common_prefix(&pathspec); > -- > 1.9.1.345.ga1a145c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html