From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
"Enzo Matsumiya" <ematsumiya@suse.de>,
"Eric Sunshine" <sunshine@sunshineco.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v2 4/4] run-command API users: use "env" not "env_array" in comments & names
Date: Fri, 20 May 2022 09:24:42 +0200 [thread overview]
Message-ID: <patch-v2-4.4-5419f839c74-20220520T072122Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-v2-0.4-00000000000-20220520T072122Z-avarab@gmail.com>
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>
---
builtin/submodule--helper.c | 2 +-
run-command.c | 6 +++---
run-command.h | 10 +++++-----
sequencer.c | 6 +++---
submodule.h | 4 ++--
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index b855e544bd6..0d37b9dd5bb 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -513,7 +513,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
* on windows. And since environment variables are
* case-insensitive in windows, it interferes with the
* existing PATH variable. Hence, to avoid that, we expose
- * path via the args strvec and not via env_array.
+ * path via the args strvec and not via env.
*/
sq_quote_buf(&sb, path);
strvec_pushf(&cp.args, "path=%s; %s",
diff --git a/run-command.c b/run-command.c
index 5f7ea713f06..789eaa59750 100644
--- a/run-command.c
+++ b/run-command.c
@@ -1816,16 +1816,16 @@ int run_auto_maintenance(int quiet)
return run_command(&maint);
}
-void prepare_other_repo_env(struct strvec *env_array, const char *new_git_dir)
+void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
{
const char * const *var;
for (var = local_repo_env; *var; var++) {
if (strcmp(*var, CONFIG_DATA_ENVIRONMENT) &&
strcmp(*var, CONFIG_COUNT_ENVIRONMENT))
- strvec_push(env_array, *var);
+ strvec_push(env, *var);
}
- strvec_pushf(env_array, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir);
+ strvec_pushf(env, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir);
}
enum start_bg_result start_bg_command(struct child_process *cmd,
diff --git a/run-command.h b/run-command.h
index d52ebc42b97..8a700da0998 100644
--- a/run-command.h
+++ b/run-command.h
@@ -58,7 +58,7 @@ struct child_process {
struct strvec args;
/**
- * Like .args the .env_array is a `struct strvec'.
+ * Like .args the .env is a `struct strvec'.
*
* To modify the environment of the sub-process, specify an array of
* environment settings. Each string in the array manipulates the
@@ -70,7 +70,7 @@ struct child_process {
* - If the string does not contain '=', it names an environment
* variable that will be removed from the child process's environment.
*
- * The memory in .env_array will be cleaned up automatically during
+ * The memory in .env will be cleaned up automatically during
* `finish_command` (or during `start_command` when it is unsuccessful).
*/
struct strvec env;
@@ -479,14 +479,14 @@ int run_processes_parallel_tr2(int n, get_next_task_fn, start_failure_fn,
const char *tr2_category, const char *tr2_label);
/**
- * Convenience function which prepares env_array for a command to be run in a
- * new repo. This adds all GIT_* environment variables to env_array with the
+ * Convenience function which prepares env for a command to be run in a
+ * new repo. This adds all GIT_* environment variables to env with the
* exception of GIT_CONFIG_PARAMETERS and GIT_CONFIG_COUNT (which cause the
* corresponding environment variables to be unset in the subprocess) and adds
* an environment variable pointing to new_git_dir. See local_repo_env in
* cache.h for more information.
*/
-void prepare_other_repo_env(struct strvec *env_array, const char *new_git_dir);
+void prepare_other_repo_env(struct strvec *env, const char *new_git_dir);
/**
* Possible return values for start_bg_command().
diff --git a/sequencer.c b/sequencer.c
index 701e420cddd..2ef6bf22e87 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -919,7 +919,7 @@ static char *get_author(const char *message)
return NULL;
}
-static const char *author_date_from_env_array(const struct strvec *env)
+static const char *author_date_from_env(const struct strvec *env)
{
int i;
const char *date;
@@ -1011,7 +1011,7 @@ static int run_git_commit(const char *defmsg,
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
opts->ignore_date ?
"" :
- author_date_from_env_array(&cmd.env));
+ author_date_from_env(&cmd.env));
if (opts->ignore_date)
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
@@ -3922,7 +3922,7 @@ static int do_merge(struct repository *r,
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
opts->ignore_date ?
"" :
- author_date_from_env_array(&cmd.env));
+ author_date_from_env(&cmd.env));
if (opts->ignore_date)
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
diff --git a/submodule.h b/submodule.h
index 40c14452377..2ac7a04e726 100644
--- a/submodule.h
+++ b/submodule.h
@@ -158,11 +158,11 @@ int submodule_move_head(const char *path,
void submodule_unset_core_worktree(const struct submodule *sub);
/*
- * Prepare the "env_array" parameter of a "struct child_process" for executing
+ * Prepare the "env" parameter of a "struct child_process" for executing
* a submodule by clearing any repo-specific environment variables, but
* retaining any config in the environment.
*/
-void prepare_submodule_repo_env(struct strvec *out);
+void prepare_submodule_repo_env(struct strvec *env);
#define ABSORB_GITDIR_RECURSE_SUBMODULES (1<<0)
void absorb_git_dir_into_superproject(const char *path,
--
2.36.1.957.g2c13267e09b
next prev parent reply other threads:[~2022-05-20 7:25 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-16 2:32 What's cooking in git.git (Dec 2021, #04; Wed, 15) Junio C Hamano
2021-12-16 11:51 ` ab/run-command (was: What's cooking in git.git (Dec 2021, #04; Wed, 15)) Ævar Arnfjörð Bjarmason
2021-12-16 15:31 ` Jeff King
2021-12-16 15:38 ` Ævar Arnfjörð Bjarmason
2021-12-16 19:11 ` ab/run-command Junio C Hamano
2022-04-06 10:42 ` [PATCH 0/3] run-command.h: rename "env_array" to "env" Ævar Arnfjörð Bjarmason
2022-04-06 10:42 ` [PATCH 1/3] cocci: add a rename of "struct child_process"'s " Ævar Arnfjörð Bjarmason
2022-04-06 10:42 ` [PATCH 2/3] run-command API: rename " Ævar Arnfjörð Bjarmason
2022-04-06 10:42 ` [PATCH 3/3] run-command API users: use "env" not "env_array" in comments & names Ævar Arnfjörð Bjarmason
2022-04-07 12:09 ` [PATCH 0/3] run-command.h: rename "env_array" to "env" Johannes Schindelin
2022-04-07 16:48 ` Junio C Hamano
2022-04-07 17:52 ` Junio C Hamano
2022-05-20 7:24 ` [PATCH v2 0/4] " Ævar Arnfjörð Bjarmason
2022-05-20 7:24 ` [PATCH v2 1/4] cocci: add a rename of "struct child_process"'s " Ævar Arnfjörð Bjarmason
2022-05-20 7:24 ` [PATCH v2 2/4] run-command API: rename " Ævar Arnfjörð Bjarmason
2022-05-20 7:24 ` [PATCH v2 3/4] cocci: remove env_array -> env migration Ævar Arnfjörð Bjarmason
2022-05-20 7:24 ` Ævar Arnfjörð Bjarmason [this message]
2022-05-20 16:27 ` [PATCH v2 0/4] run-command.h: rename "env_array" to "env" Junio C Hamano
2022-05-21 11:09 ` Ævar Arnfjörð Bjarmason
2022-06-02 9:09 ` [PATCH v3 0/2] " Ævar Arnfjörð Bjarmason
2022-06-02 9:09 ` [PATCH v3 1/2] run-command API: " Ævar Arnfjörð Bjarmason
2022-06-03 0:37 ` Junio C Hamano
2022-06-02 9:09 ` [PATCH v3 2/2] run-command API users: use "env" not "env_array" in comments & names Ævar Arnfjörð Bjarmason
2021-12-16 23:46 ` ab/make-dependency (was: What's cooking in git.git (Dec 2021, #04; Wed, 15)) Ævar Arnfjörð Bjarmason
2021-12-21 1:34 ` What's cooking in git.git (Dec 2021, #04; Wed, 15) Aleen 徐沛文
2021-12-21 7:30 ` Christian Couder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=patch-v2-4.4-5419f839c74-20220520T072122Z-avarab@gmail.com \
--to=avarab@gmail.com \
--cc=ematsumiya@suse.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=peff@peff.net \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).