Skip to content

Commit b319325

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 29fda24 commit b319325

File tree

5 files changed

+14
-14
lines changed

5 files changed

+14
-14
lines changed

builtin/submodule--helper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
513513
* on windows. And since environment variables are
514514
* case-insensitive in windows, it interferes with the
515515
* 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.
517517
*/
518518
sq_quote_buf(&sb, path);
519519
strvec_pushf(&cp.args, "path=%s; %s",

run-command.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,16 +1816,16 @@ int run_auto_maintenance(int quiet)
18161816
return run_command(&maint);
18171817
}
18181818

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)
18201820
{
18211821
const char * const *var;
18221822

18231823
for (var = local_repo_env; *var; var++) {
18241824
if (strcmp(*var, CONFIG_DATA_ENVIRONMENT) &&
18251825
strcmp(*var, CONFIG_COUNT_ENVIRONMENT))
1826-
strvec_push(env_array, *var);
1826+
strvec_push(env, *var);
18271827
}
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);
18291829
}
18301830

18311831
enum start_bg_result start_bg_command(struct child_process *cmd,

run-command.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct child_process {
5858
struct strvec args;
5959

6060
/**
61-
* Like .args the .env_array is a `struct strvec'.
61+
* Like .args the .env is a `struct strvec'.
6262
*
6363
* To modify the environment of the sub-process, specify an array of
6464
* environment settings. Each string in the array manipulates the
@@ -70,7 +70,7 @@ struct child_process {
7070
* - If the string does not contain '=', it names an environment
7171
* variable that will be removed from the child process's environment.
7272
*
73-
* The memory in .env_array will be cleaned up automatically during
73+
* The memory in .env will be cleaned up automatically during
7474
* `finish_command` (or during `start_command` when it is unsuccessful).
7575
*/
7676
struct strvec env;
@@ -480,14 +480,14 @@ int run_processes_parallel_tr2(int n, get_next_task_fn, start_failure_fn,
480480
const char *tr2_category, const char *tr2_label);
481481

482482
/**
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
485485
* exception of GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT (which cause the
486486
* corresponding environment variables to be unset in the subprocess) and adds
487487
* an environment variable pointing to new_git_dir. See local_repo_env in
488488
* cache.h for more information.
489489
*/
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);
491491

492492
/**
493493
* Possible return values for start_bg_command().

sequencer.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ static char *get_author(const char *message)
919919
return NULL;
920920
}
921921

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)
923923
{
924924
int i;
925925
const char *date;
@@ -1011,7 +1011,7 @@ static int run_git_commit(const char *defmsg,
10111011
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
10121012
opts->ignore_date ?
10131013
"" :
1014-
author_date_from_env_array(&cmd.env));
1014+
author_date_from_env(&cmd.env));
10151015
if (opts->ignore_date)
10161016
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
10171017

@@ -3923,7 +3923,7 @@ static int do_merge(struct repository *r,
39233923
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
39243924
opts->ignore_date ?
39253925
"" :
3926-
author_date_from_env_array(&cmd.env));
3926+
author_date_from_env(&cmd.env));
39273927
if (opts->ignore_date)
39283928
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
39293929

submodule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ int submodule_move_head(const char *path,
158158
void submodule_unset_core_worktree(const struct submodule *sub);
159159

160160
/*
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
162162
* a submodule by clearing any repo-specific environment variables, but
163163
* retaining any config in the environment.
164164
*/
165-
void prepare_submodule_repo_env(struct strvec *out);
165+
void prepare_submodule_repo_env(struct strvec *env);
166166

167167
#define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
168168
void absorb_git_dir_into_superproject(const char *path,

0 commit comments

Comments
 (0)