This will allow us to refactor the loop to use the parallel process
API.

Signed-off-by: Stefan Beller <sbel...@google.com>
---
 builtin/submodule--helper.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d1684cf..fa8c008 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -297,6 +297,8 @@ static int module_list_or_clone(int argc, const char 
**argv, const char *prefix)
        char *update = NULL;
        struct pathspec pathspec;
        struct module_list list = MODULE_LIST_INIT;
+       struct string_list projectlines = STRING_LIST_INIT_DUP;
+       struct string_list_item *item;
 
        struct option module_list_options[] = {
                OPT_STRING(0, "prefix", &prefix,
@@ -403,9 +405,15 @@ static int module_list_or_clone(int argc, const char 
**argv, const char *prefix)
                                return 1;
                        }
                }
+               strbuf_reset(&sb);
+               strbuf_addf(&sb, "%06o %s %d %d\t%s\n", ce->ce_mode,
+                               sha1_to_hex(ce->sha1), ce_stage(ce),
+                               just_cloned, ce->name);
+               string_list_append(&projectlines, sb.buf);
+       }
 
-               printf("%06o %s %d %d\t", ce->ce_mode, sha1_to_hex(ce->sha1), 
ce_stage(ce), just_cloned);
-               utf8_fprintf(stdout, "%s\n", ce->name);
+       for_each_string_list_item(item, &projectlines) {
+               utf8_fprintf(stdout, "%s", item->string);
        }
        return 0;
 }
-- 
2.5.0.277.gfdc362b.dirty

--
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

Reply via email to