update submodules: move up prepare_submodule_repo_env

In a later patch we need to prepare the submodule environment with another git directory, so split up the function. Also move it up in the file such that we do not need to declare the function later before using it. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Stefan Beller committed Mar 14, 2017 at 14:46 UTC 6cd5757c898d845747d9886c71cb5884b56e9702
1 file changed +17 -12
submodule.c
+17 -12
@@ -356,6 +356,23 @@ static void print_submodule_summary(struct rev_info *rev, FILE *f,
356 strbuf_release(&sb);
357 }
358
359 +static void prepare_submodule_repo_env_no_git_dir(struct argv_array *out)
360 +{
361 + const char * const *var;
362 +
363 + for (var = local_repo_env; *var; var++) {
364 + if (strcmp(*var, CONFIG_DATA_ENVIRONMENT))
365 + argv_array_push(out, *var);
366 + }
367 +}
368 +
369 +void prepare_submodule_repo_env(struct argv_array *out)
370 +{
371 + prepare_submodule_repo_env_no_git_dir(out);
372 + argv_array_pushf(out, "%s=%s", GIT_DIR_ENVIRONMENT,
373 + DEFAULT_GIT_DIR_ENVIRONMENT);
374 +}
375 +
376 /* Helper function to display the submodule header line prior to the full
377 * summary output. If it can locate the submodule objects directory it will
378 * attempt to lookup both the left and right commits and put them into the
@@ -1390,18 +1407,6 @@ int parallel_submodules(void)
1407 return parallel_jobs;
1408 }
1409
1393 -void prepare_submodule_repo_env(struct argv_array *out)
1394 -{
1395 - const char * const *var;
1396 -
1397 - for (var = local_repo_env; *var; var++) {
1398 - if (strcmp(*var, CONFIG_DATA_ENVIRONMENT))
1399 - argv_array_push(out, *var);
1400 - }
1401 - argv_array_pushf(out, "%s=%s", GIT_DIR_ENVIRONMENT,
1402 - DEFAULT_GIT_DIR_ENVIRONMENT);
1403 -}
1404 -
1410 /*
1411 * Embeds a single submodules git directory into the superprojects git dir,
1412 * non recursively.