run-command API users: use "env" not "env_array" in comments & names

Follow-up on a preceding commit which changed all references to the "env_array" when referring to the "struct child_process" member. These changes are all unnecessary for the compiler, but help the code's human readers. All the comments that referred to "env_array" have now been updated, as well as function names and variables that had "env_array" in their name, they now refer to "env". In addition the "out" name for the submodule.h prototype was inconsistent with the function definition's use of "env_array" in submodule.c. Both of them use "env" now. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jun 2, 2022 at 11:09 UTC b3193252c4278e9039fbb896a35f84abc1fb5aac
5 files changed +14 -14
builtin/submodule--helper.c
+1 -1
@@ -513,7 +513,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
513 * on windows. And since environment variables are
514 * case-insensitive in windows, it interferes with the
515 * existing PATH variable. Hence, to avoid that, we expose
516 - * path via the args strvec and not via env_array.
516 + * path via the args strvec and not via env.
517 */
518 sq_quote_buf(&sb, path);
519 strvec_pushf(&cp.args, "path=%s; %s",
run-command.c
+3 -3
@@ -1816,16 +1816,16 @@ int run_auto_maintenance(int quiet)
1816 return run_command(&maint);
1817 }
1818
1819 -void prepare_other_repo_env(struct strvec *env_array, const char *new_git_dir)
1819 +void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
1820 {
1821 const char * const *var;
1822
1823 for (var = local_repo_env; *var; var++) {
1824 if (strcmp(*var, CONFIG_DATA_ENVIRONMENT) &&
1825 strcmp(*var, CONFIG_COUNT_ENVIRONMENT))
1826 - strvec_push(env_array, *var);
1826 + strvec_push(env, *var);
1827 }
1828 - strvec_pushf(env_array, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir);
1828 + strvec_pushf(env, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir);
1829 }
1830
1831 enum start_bg_result start_bg_command(struct child_process *cmd,
run-command.h
+5 -5
@@ -58,7 +58,7 @@ struct child_process {
58 struct strvec args;
59
60 /**
61 - * Like .args the .env_array is a `struct strvec'.
61 + * Like .args the .env is a `struct strvec'.
62 *
63 * To modify the environment of the sub-process, specify an array of
64 * environment settings. Each string in the array manipulates the
@@ -70,7 +70,7 @@ struct child_process {
70 * - If the string does not contain '=', it names an environment
71 * variable that will be removed from the child process's environment.
72 *
73 - * The memory in .env_array will be cleaned up automatically during
73 + * The memory in .env will be cleaned up automatically during
74 * `finish_command` (or during `start_command` when it is unsuccessful).
75 */
76 struct strvec env;
@@ -480,14 +480,14 @@ int run_processes_parallel_tr2(int n, get_next_task_fn, start_failure_fn,
480 const char *tr2_category, const char *tr2_label);
481
482 /**
483 - * Convenience function which prepares env_array for a command to be run in a
484 - * new repo. This adds all GIT_* environment variables to env_array with the
483 + * Convenience function which prepares env for a command to be run in a
484 + * new repo. This adds all GIT_* environment variables to env with the
485 * exception of GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT (which cause the
486 * corresponding environment variables to be unset in the subprocess) and adds
487 * an environment variable pointing to new_git_dir. See local_repo_env in
488 * cache.h for more information.
489 */
490 -void prepare_other_repo_env(struct strvec *env_array, const char *new_git_dir);
490 +void prepare_other_repo_env(struct strvec *env, const char *new_git_dir);
491
492 /**
493 * Possible return values for start_bg_command().
sequencer.c
+3 -3
@@ -919,7 +919,7 @@ static char *get_author(const char *message)
919 return NULL;
920 }
921
922 -static const char *author_date_from_env_array(const struct strvec *env)
922 +static const char *author_date_from_env(const struct strvec *env)
923 {
924 int i;
925 const char *date;
@@ -1011,7 +1011,7 @@ static int run_git_commit(const char *defmsg,
1011 strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
1012 opts->ignore_date ?
1013 "" :
1014 - author_date_from_env_array(&cmd.env));
1014 + author_date_from_env(&cmd.env));
1015 if (opts->ignore_date)
1016 strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
1017
@@ -3923,7 +3923,7 @@ static int do_merge(struct repository *r,
3923 strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
3924 opts->ignore_date ?
3925 "" :
3926 - author_date_from_env_array(&cmd.env));
3926 + author_date_from_env(&cmd.env));
3927 if (opts->ignore_date)
3928 strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
3929
submodule.h
+2 -2
@@ -158,11 +158,11 @@ int submodule_move_head(const char *path,
158 void submodule_unset_core_worktree(const struct submodule *sub);
159
160 /*
161 - * Prepare the "env_array" parameter of a "struct child_process" for executing
161 + * Prepare the "env" parameter of a "struct child_process" for executing
162 * a submodule by clearing any repo-specific environment variables, but
163 * retaining any config in the environment.
164 */
165 -void prepare_submodule_repo_env(struct strvec *out);
165 +void prepare_submodule_repo_env(struct strvec *env);
166
167 #define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
168 void absorb_git_dir_into_superproject(const char *path,