Subject: Re: [PATCH v6 3/4] ls-files: pass through safe options for --recurse-submodules

From: Junio C Hamano <[email-masked]>
Date: Thu, 29 Sep 2016 17:14:07 -0700

Brandon Williams <[email-masked]> writes:

> +static void compile_submodule_options(const struct dir_struct *dir, int show_tag)
> +{
> +	if (line_terminator == '\0')
> +		argv_array_push(&submodules_options, "-z");
> +	if (show_tag)
> +		argv_array_push(&submodules_options, "-t");
> +	if (show_valid_bit)
> +		argv_array_push(&submodules_options, "-v");
> +	if (show_cached)
> +		argv_array_push(&submodules_options, "--cached");
> +	if (show_deleted)
> +		argv_array_push(&submodules_options, "--deleted");
> +	if (show_modified)
> +		argv_array_push(&submodules_options, "--modified");
> +	if (show_others)
> +		argv_array_push(&submodules_options, "--others");
> +	if (dir->flags & DIR_SHOW_IGNORED)
> +		argv_array_push(&submodules_options, "--ignored");
> +	if (show_stage)
> +		argv_array_push(&submodules_options, "--stage");
> +	if (show_killed)
> +		argv_array_push(&submodules_options, "--killed");
> +	if (dir->flags & DIR_SHOW_OTHER_DIRECTORIES)
> +		argv_array_push(&submodules_options, "--directory");
> +	if (!(dir->flags & DIR_SHOW_OTHER_DIRECTORIES))
> +		argv_array_push(&submodules_options, "--empty-directory");
> +	if (show_unmerged)
> +		argv_array_push(&submodules_options, "--unmerged");
> +	if (show_resolve_undo)
> +		argv_array_push(&submodules_options, "--resolve-undo");
> +	if (show_eol)
> +		argv_array_push(&submodules_options, "--eol");
> +	if (debug_mode)
> +		argv_array_push(&submodules_options, "--debug");
> +}

With this and 4/4 applied, the documentation still says "--cached"
is the only supported option.

Does it really make sense to pass all of these?  I understand "-z"
and I suspect things like "-t" and "-v" that affect "how" things are
shown may also happen to work, but I am not sure how much it makes
sense for options that affect "what" things are shown.

What does it even mean to ask for say "--unmerged" to be shown, for
example, from the superproject?  Recurse into submodules whose cache
entries in the index of the superproject are unmerged, or something
else?

I am inclined to say that it is probably better to keep the
"--cached only" as documented, at least on the "what are shown"
side.

Thanks.