Merge branch 'ab/env-array'
Rename .env_array member to .env in the child_process structure. * ab/env-array: run-command API users: use "env" not "env_array" in comments & names run-command API: rename "env_array" to "env"
This commit is contained in:
@ -163,7 +163,7 @@ static char *compute_rev_name(const char *sub_path, const char* object_id)
|
||||
|
||||
for (d = describe_argv; *d; d++) {
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.dir = sub_path;
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stderr = 1;
|
||||
@ -350,7 +350,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
|
||||
if (!is_submodule_populated_gently(path, NULL))
|
||||
goto cleanup;
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
|
||||
/*
|
||||
* For the purpose of executing <command> in the submodule,
|
||||
@ -370,12 +370,12 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
|
||||
char *toplevel = xgetcwd();
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
|
||||
strvec_pushf(&cp.env_array, "name=%s", sub->name);
|
||||
strvec_pushf(&cp.env_array, "sm_path=%s", path);
|
||||
strvec_pushf(&cp.env_array, "displaypath=%s", displaypath);
|
||||
strvec_pushf(&cp.env_array, "sha1=%s",
|
||||
strvec_pushf(&cp.env, "name=%s", sub->name);
|
||||
strvec_pushf(&cp.env, "sm_path=%s", path);
|
||||
strvec_pushf(&cp.env, "displaypath=%s", displaypath);
|
||||
strvec_pushf(&cp.env, "sha1=%s",
|
||||
oid_to_hex(ce_oid));
|
||||
strvec_pushf(&cp.env_array, "toplevel=%s", toplevel);
|
||||
strvec_pushf(&cp.env, "toplevel=%s", toplevel);
|
||||
|
||||
/*
|
||||
* Since the path variable was accessible from the script
|
||||
@ -384,7 +384,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",
|
||||
@ -407,7 +407,7 @@ static void runcommand_in_submodule_cb(const struct cache_entry *list_item,
|
||||
|
||||
cpr.git_cmd = 1;
|
||||
cpr.dir = path;
|
||||
prepare_submodule_repo_env(&cpr.env_array);
|
||||
prepare_submodule_repo_env(&cpr.env);
|
||||
|
||||
strvec_pushl(&cpr.args, "--super-prefix", NULL);
|
||||
strvec_pushf(&cpr.args, "%s/", displaypath);
|
||||
@ -716,7 +716,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||
|
||||
cpr.git_cmd = 1;
|
||||
cpr.dir = path;
|
||||
prepare_submodule_repo_env(&cpr.env_array);
|
||||
prepare_submodule_repo_env(&cpr.env);
|
||||
|
||||
strvec_push(&cpr.args, "--super-prefix");
|
||||
strvec_pushf(&cpr.args, "%s/", displaypath);
|
||||
@ -839,7 +839,7 @@ static char *verify_submodule_committish(const char *sm_path,
|
||||
|
||||
cp_rev_parse.git_cmd = 1;
|
||||
cp_rev_parse.dir = sm_path;
|
||||
prepare_submodule_repo_env(&cp_rev_parse.env_array);
|
||||
prepare_submodule_repo_env(&cp_rev_parse.env);
|
||||
strvec_pushl(&cp_rev_parse.args, "rev-parse", "-q", "--short", NULL);
|
||||
strvec_pushf(&cp_rev_parse.args, "%s^0", committish);
|
||||
strvec_push(&cp_rev_parse.args, "--");
|
||||
@ -880,7 +880,7 @@ static void print_submodule_summary(struct summary_cb *info, char *errmsg,
|
||||
|
||||
cp_log.git_cmd = 1;
|
||||
cp_log.dir = p->sm_path;
|
||||
prepare_submodule_repo_env(&cp_log.env_array);
|
||||
prepare_submodule_repo_env(&cp_log.env);
|
||||
strvec_pushl(&cp_log.args, "log", NULL);
|
||||
|
||||
if (S_ISGITLINK(p->mod_src) && S_ISGITLINK(p->mod_dst)) {
|
||||
@ -997,7 +997,7 @@ static void generate_submodule_summary(struct summary_cb *info,
|
||||
|
||||
cp_rev_list.git_cmd = 1;
|
||||
cp_rev_list.dir = p->sm_path;
|
||||
prepare_submodule_repo_env(&cp_rev_list.env_array);
|
||||
prepare_submodule_repo_env(&cp_rev_list.env);
|
||||
|
||||
if (!capture_command(&cp_rev_list, &sb_rev_list, 0))
|
||||
total_commits = atoi(sb_rev_list.buf);
|
||||
@ -1303,7 +1303,7 @@ static void sync_submodule(const char *path, const char *prefix,
|
||||
|
||||
cpr.git_cmd = 1;
|
||||
cpr.dir = path;
|
||||
prepare_submodule_repo_env(&cpr.env_array);
|
||||
prepare_submodule_repo_env(&cpr.env);
|
||||
|
||||
strvec_push(&cpr.args, "--super-prefix");
|
||||
strvec_pushf(&cpr.args, "%s/", displaypath);
|
||||
@ -1708,7 +1708,7 @@ static int clone_submodule(struct module_clone_data *clone_data)
|
||||
strvec_push(&cp.args, clone_data->path);
|
||||
|
||||
cp.git_cmd = 1;
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.no_stdin = 1;
|
||||
|
||||
if(run_command(&cp))
|
||||
@ -2183,7 +2183,7 @@ static int is_tip_reachable(const char *path, struct object_id *oid)
|
||||
cp.no_stderr = 1;
|
||||
strvec_pushl(&cp.args, "rev-list", "-n", "1", hex, "--not", "--all", NULL);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
|
||||
if (capture_command(&cp, &rev, GIT_MAX_HEXSZ + 1) || rev.len)
|
||||
return 0;
|
||||
@ -2195,7 +2195,7 @@ static int fetch_in_submodule(const char *module_path, int depth, int quiet, str
|
||||
{
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.dir = xstrdup(module_path);
|
||||
|
||||
@ -2252,7 +2252,7 @@ static int run_update_command(struct update_data *ud, int subforce)
|
||||
strvec_push(&cp.args, oid);
|
||||
|
||||
cp.dir = xstrdup(ud->sm_path);
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
if (run_command(&cp)) {
|
||||
switch (ud->update_strategy.type) {
|
||||
case SM_UPDATE_CHECKOUT:
|
||||
@ -2518,7 +2518,7 @@ static int update_submodule(struct update_data *update_data)
|
||||
|
||||
cp.dir = update_data->sm_path;
|
||||
cp.git_cmd = 1;
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
update_data_to_args(&next, &cp.args);
|
||||
|
||||
/* die() if child process die()'d */
|
||||
@ -3011,9 +3011,9 @@ static void append_fetch_remotes(struct strbuf *msg, const char *git_dir_path)
|
||||
struct strbuf sb_remote_out = STRBUF_INIT;
|
||||
|
||||
cp_remote.git_cmd = 1;
|
||||
strvec_pushf(&cp_remote.env_array,
|
||||
strvec_pushf(&cp_remote.env,
|
||||
"GIT_DIR=%s", git_dir_path);
|
||||
strvec_push(&cp_remote.env_array, "GIT_WORK_TREE=.");
|
||||
strvec_push(&cp_remote.env, "GIT_WORK_TREE=.");
|
||||
strvec_pushl(&cp_remote.args, "remote", "-v", NULL);
|
||||
if (!capture_command(&cp_remote, &sb_remote_out, 0)) {
|
||||
char *next_line;
|
||||
@ -3097,7 +3097,7 @@ static int add_submodule(const struct add_data *add_data)
|
||||
if (clone_submodule(&clone_data))
|
||||
return -1;
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.dir = add_data->sm_path;
|
||||
/*
|
||||
|
Reference in New Issue
Block a user