Thread (2 messages) 2 messages, 2 authors, 2016-09-27

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

From: Brandon Williams <hidden>
Date: 2016-09-27 20:50:13

Possibly related (same subject, not in this thread)

On 09/27, Junio C Hamano wrote:
Brandon Williams [off-list ref] writes:
quoted
@@ -170,6 +171,27 @@ static void show_killed_files(struct dir_struct *dir)
 	}
 }
 
+/*
+ * Compile an argv_array with all of the options supported by --recurse_submodules
+ */
+static void compile_submodule_options(int show_tag)
+{
+	if (show_cached)
+		argv_array_push(&recurse_submodules_opts, "--cached");
+	if (show_stage)
+		argv_array_push(&recurse_submodules_opts, "--stage");
+	if (show_valid_bit)
+		argv_array_push(&recurse_submodules_opts, "-v");
+	if (show_tag)
+		argv_array_push(&recurse_submodules_opts, "-t");
+	if (line_terminator == '\0')
+		argv_array_push(&recurse_submodules_opts, "-z");
+	if (debug_mode)
+		argv_array_push(&recurse_submodules_opts, "--debug");
+	if (show_eol)
+		argv_array_push(&recurse_submodules_opts, "--eol");
+}
OK.  These are only the safe ones to pass through?  "compile" or
"assemble" is much less important thing to say than how these are
chosen.  "pass_supported_options()" or something?  I dunno.
Alternatively we can change this to compile all potential options (not
just the ones that are supported now) and then just error the caller
out, as you've suggested, if an unsupported option used.  'pass' may not
be the most descriptive word for this function as it isn't actually
doing the passing but rather generating an argv of options that will be
passed in the event a submodule is found and we need to kick off a child
process for it.

-- 
Brandon Williams
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help