From 50d89ad6542c8acafefa6d42f8b42dfa9b8fafe1 Mon Sep 17 00:00:00 2001 From: Jens Lehmann Date: Sat, 1 Sep 2012 17:27:06 +0200 Subject: submodule: use argv_array instead of hand-building arrays fetch_populated_submodules() allocates the full argv array it uses to recurse into the submodules from the number of given options plus the six argv values it is going to add. It then initializes it with those values which won't change during the iteration and copies the given options into it. Inside the loop the two argv values different for each submodule get replaced with those currently valid. However, this technique is brittle and error-prone (as the comment to explain the magic number 6 indicates), so let's replace it with an argv_array. Instead of replacing the argv values, push them to the argv_array just before the run_command() call (including the option separating them) and pop them from the argv_array right after that. Signed-off-by: Jens Lehmann Signed-off-by: Junio C Hamano --- builtin/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'builtin/fetch.c') diff --git a/builtin/fetch.c b/builtin/fetch.c index d5442e1eb7..6196e91798 100644 --- a/builtin/fetch.c +++ b/builtin/fetch.c @@ -1012,7 +1012,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix) struct argv_array options = ARGV_ARRAY_INIT; add_options_to_argv(&options); - result = fetch_populated_submodules(options.argc, options.argv, + result = fetch_populated_submodules(&options, submodule_prefix, recurse_submodules, verbosity < 0); -- cgit v1.2.3