зеркало из https://github.com/microsoft/git.git
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:
Коммит
c21fa3bb54
|
@ -305,7 +305,7 @@ static void setup_child_process(struct add_p_state *s,
|
|||
va_end(ap);
|
||||
|
||||
cp->git_cmd = 1;
|
||||
strvec_pushf(&cp->env_array,
|
||||
strvec_pushf(&cp->env,
|
||||
INDEX_ENVIRONMENT "=%s", s->s.r->index_file);
|
||||
}
|
||||
|
||||
|
|
2
branch.c
2
branch.c
|
@ -587,7 +587,7 @@ static int submodule_create_branch(struct repository *r,
|
|||
child.err = -1;
|
||||
child.stdout_to_stderr = 1;
|
||||
|
||||
prepare_other_repo_env(&child.env_array, r->gitdir);
|
||||
prepare_other_repo_env(&child.env, r->gitdir);
|
||||
/*
|
||||
* submodule_create_branch() is indirectly invoked by "git
|
||||
* branch", but we cannot invoke "git branch" in the child
|
||||
|
|
|
@ -217,7 +217,7 @@ static void changed_files(struct hashmap *result, const char *index_path,
|
|||
update_index.use_shell = 0;
|
||||
update_index.clean_on_exit = 1;
|
||||
update_index.dir = workdir;
|
||||
strvec_pushf(&update_index.env_array, "GIT_INDEX_FILE=%s", index_path);
|
||||
strvec_pushf(&update_index.env, "GIT_INDEX_FILE=%s", index_path);
|
||||
/* Ignore any errors of update-index */
|
||||
run_command(&update_index);
|
||||
|
||||
|
@ -230,7 +230,7 @@ static void changed_files(struct hashmap *result, const char *index_path,
|
|||
diff_files.clean_on_exit = 1;
|
||||
diff_files.out = -1;
|
||||
diff_files.dir = workdir;
|
||||
strvec_pushf(&diff_files.env_array, "GIT_INDEX_FILE=%s", index_path);
|
||||
strvec_pushf(&diff_files.env, "GIT_INDEX_FILE=%s", index_path);
|
||||
if (start_command(&diff_files))
|
||||
die("could not obtain raw diff");
|
||||
fp = xfdopen(diff_files.out, "r");
|
||||
|
@ -675,7 +675,7 @@ static int run_file_diff(int prompt, const char *prefix,
|
|||
|
||||
child->git_cmd = 1;
|
||||
child->dir = prefix;
|
||||
strvec_pushv(&child->env_array, env);
|
||||
strvec_pushv(&child->env, env);
|
||||
|
||||
return run_command(child);
|
||||
}
|
||||
|
|
|
@ -764,23 +764,23 @@ static void prepare_push_cert_sha1(struct child_process *proc)
|
|||
nonce_status = check_nonce(push_cert.buf, bogs);
|
||||
}
|
||||
if (!is_null_oid(&push_cert_oid)) {
|
||||
strvec_pushf(&proc->env_array, "GIT_PUSH_CERT=%s",
|
||||
strvec_pushf(&proc->env, "GIT_PUSH_CERT=%s",
|
||||
oid_to_hex(&push_cert_oid));
|
||||
strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_SIGNER=%s",
|
||||
strvec_pushf(&proc->env, "GIT_PUSH_CERT_SIGNER=%s",
|
||||
sigcheck.signer ? sigcheck.signer : "");
|
||||
strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_KEY=%s",
|
||||
strvec_pushf(&proc->env, "GIT_PUSH_CERT_KEY=%s",
|
||||
sigcheck.key ? sigcheck.key : "");
|
||||
strvec_pushf(&proc->env_array, "GIT_PUSH_CERT_STATUS=%c",
|
||||
strvec_pushf(&proc->env, "GIT_PUSH_CERT_STATUS=%c",
|
||||
sigcheck.result);
|
||||
if (push_cert_nonce) {
|
||||
strvec_pushf(&proc->env_array,
|
||||
strvec_pushf(&proc->env,
|
||||
"GIT_PUSH_CERT_NONCE=%s",
|
||||
push_cert_nonce);
|
||||
strvec_pushf(&proc->env_array,
|
||||
strvec_pushf(&proc->env,
|
||||
"GIT_PUSH_CERT_NONCE_STATUS=%s",
|
||||
nonce_status);
|
||||
if (nonce_status == NONCE_SLOP)
|
||||
strvec_pushf(&proc->env_array,
|
||||
strvec_pushf(&proc->env,
|
||||
"GIT_PUSH_CERT_NONCE_SLOP=%ld",
|
||||
nonce_stamp_slop);
|
||||
}
|
||||
|
@ -815,17 +815,17 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed,
|
|||
if (feed_state->push_options) {
|
||||
size_t i;
|
||||
for (i = 0; i < feed_state->push_options->nr; i++)
|
||||
strvec_pushf(&proc.env_array,
|
||||
strvec_pushf(&proc.env,
|
||||
"GIT_PUSH_OPTION_%"PRIuMAX"=%s",
|
||||
(uintmax_t)i,
|
||||
feed_state->push_options->items[i].string);
|
||||
strvec_pushf(&proc.env_array, "GIT_PUSH_OPTION_COUNT=%"PRIuMAX"",
|
||||
strvec_pushf(&proc.env, "GIT_PUSH_OPTION_COUNT=%"PRIuMAX"",
|
||||
(uintmax_t)feed_state->push_options->nr);
|
||||
} else
|
||||
strvec_pushf(&proc.env_array, "GIT_PUSH_OPTION_COUNT");
|
||||
strvec_pushf(&proc.env, "GIT_PUSH_OPTION_COUNT");
|
||||
|
||||
if (tmp_objdir)
|
||||
strvec_pushv(&proc.env_array, tmp_objdir_env(tmp_objdir));
|
||||
strvec_pushv(&proc.env, tmp_objdir_env(tmp_objdir));
|
||||
|
||||
if (use_sideband) {
|
||||
memset(&muxer, 0, sizeof(muxer));
|
||||
|
@ -1357,7 +1357,7 @@ static const char *push_to_deploy(unsigned char *sha1,
|
|||
|
||||
strvec_pushl(&child.args, "update-index", "-q", "--ignore-submodules",
|
||||
"--refresh", NULL);
|
||||
strvec_pushv(&child.env_array, env->v);
|
||||
strvec_pushv(&child.env, env->v);
|
||||
child.dir = work_tree;
|
||||
child.no_stdin = 1;
|
||||
child.stdout_to_stderr = 1;
|
||||
|
@ -1369,7 +1369,7 @@ static const char *push_to_deploy(unsigned char *sha1,
|
|||
child_process_init(&child);
|
||||
strvec_pushl(&child.args, "diff-files", "--quiet",
|
||||
"--ignore-submodules", "--", NULL);
|
||||
strvec_pushv(&child.env_array, env->v);
|
||||
strvec_pushv(&child.env, env->v);
|
||||
child.dir = work_tree;
|
||||
child.no_stdin = 1;
|
||||
child.stdout_to_stderr = 1;
|
||||
|
@ -1383,7 +1383,7 @@ static const char *push_to_deploy(unsigned char *sha1,
|
|||
/* diff-index with either HEAD or an empty tree */
|
||||
head_has_history() ? "HEAD" : empty_tree_oid_hex(),
|
||||
"--", NULL);
|
||||
strvec_pushv(&child.env_array, env->v);
|
||||
strvec_pushv(&child.env, env->v);
|
||||
child.no_stdin = 1;
|
||||
child.no_stdout = 1;
|
||||
child.stdout_to_stderr = 0;
|
||||
|
@ -1394,7 +1394,7 @@ static const char *push_to_deploy(unsigned char *sha1,
|
|||
child_process_init(&child);
|
||||
strvec_pushl(&child.args, "read-tree", "-u", "-m", hash_to_hex(sha1),
|
||||
NULL);
|
||||
strvec_pushv(&child.env_array, env->v);
|
||||
strvec_pushv(&child.env, env->v);
|
||||
child.dir = work_tree;
|
||||
child.no_stdin = 1;
|
||||
child.no_stdout = 1;
|
||||
|
@ -2214,7 +2214,7 @@ static const char *unpack(int err_fd, struct shallow_info *si)
|
|||
close(err_fd);
|
||||
return "unable to create temporary object directory";
|
||||
}
|
||||
strvec_pushv(&child.env_array, tmp_objdir_env(tmp_objdir));
|
||||
strvec_pushv(&child.env, tmp_objdir_env(tmp_objdir));
|
||||
|
||||
/*
|
||||
* Normally we just pass the tmp_objdir environment to the child
|
||||
|
|
|
@ -356,7 +356,7 @@ static int restore_untracked(struct object_id *u_tree)
|
|||
cp.git_cmd = 1;
|
||||
strvec_push(&cp.args, "read-tree");
|
||||
strvec_push(&cp.args, oid_to_hex(u_tree));
|
||||
strvec_pushf(&cp.env_array, "GIT_INDEX_FILE=%s",
|
||||
strvec_pushf(&cp.env, "GIT_INDEX_FILE=%s",
|
||||
stash_index_path.buf);
|
||||
if (run_command(&cp)) {
|
||||
remove_path(stash_index_path.buf);
|
||||
|
@ -366,7 +366,7 @@ static int restore_untracked(struct object_id *u_tree)
|
|||
child_process_init(&cp);
|
||||
cp.git_cmd = 1;
|
||||
strvec_pushl(&cp.args, "checkout-index", "--all", NULL);
|
||||
strvec_pushf(&cp.env_array, "GIT_INDEX_FILE=%s",
|
||||
strvec_pushf(&cp.env, "GIT_INDEX_FILE=%s",
|
||||
stash_index_path.buf);
|
||||
|
||||
res = run_command(&cp);
|
||||
|
@ -602,9 +602,9 @@ restore_untracked:
|
|||
*/
|
||||
cp.git_cmd = 1;
|
||||
cp.dir = prefix;
|
||||
strvec_pushf(&cp.env_array, GIT_WORK_TREE_ENVIRONMENT"=%s",
|
||||
strvec_pushf(&cp.env, GIT_WORK_TREE_ENVIRONMENT"=%s",
|
||||
absolute_path(get_git_work_tree()));
|
||||
strvec_pushf(&cp.env_array, GIT_DIR_ENVIRONMENT"=%s",
|
||||
strvec_pushf(&cp.env, GIT_DIR_ENVIRONMENT"=%s",
|
||||
absolute_path(get_git_dir()));
|
||||
strvec_push(&cp.args, "status");
|
||||
run_command(&cp);
|
||||
|
@ -1115,7 +1115,7 @@ static int save_untracked_files(struct stash_info *info, struct strbuf *msg,
|
|||
cp_upd_index.git_cmd = 1;
|
||||
strvec_pushl(&cp_upd_index.args, "update-index", "-z", "--add",
|
||||
"--remove", "--stdin", NULL);
|
||||
strvec_pushf(&cp_upd_index.env_array, "GIT_INDEX_FILE=%s",
|
||||
strvec_pushf(&cp_upd_index.env, "GIT_INDEX_FILE=%s",
|
||||
stash_index_path.buf);
|
||||
|
||||
strbuf_addf(&untracked_msg, "untracked files on %s\n", msg->buf);
|
||||
|
@ -1189,7 +1189,7 @@ static int stash_patch(struct stash_info *info, const struct pathspec *ps,
|
|||
|
||||
cp_read_tree.git_cmd = 1;
|
||||
strvec_pushl(&cp_read_tree.args, "read-tree", "HEAD", NULL);
|
||||
strvec_pushf(&cp_read_tree.env_array, "GIT_INDEX_FILE=%s",
|
||||
strvec_pushf(&cp_read_tree.env, "GIT_INDEX_FILE=%s",
|
||||
stash_index_path.buf);
|
||||
if (run_command(&cp_read_tree)) {
|
||||
ret = -1;
|
||||
|
@ -1276,7 +1276,7 @@ static int stash_working_tree(struct stash_info *info, const struct pathspec *ps
|
|||
strvec_pushl(&cp_upd_index.args, "update-index",
|
||||
"--ignore-skip-worktree-entries",
|
||||
"-z", "--add", "--remove", "--stdin", NULL);
|
||||
strvec_pushf(&cp_upd_index.env_array, "GIT_INDEX_FILE=%s",
|
||||
strvec_pushf(&cp_upd_index.env, "GIT_INDEX_FILE=%s",
|
||||
stash_index_path.buf);
|
||||
|
||||
if (pipe_command(&cp_upd_index, diff_output.buf, diff_output.len,
|
||||
|
@ -1551,7 +1551,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
|
|||
cp.git_cmd = 1;
|
||||
if (startup_info->original_cwd) {
|
||||
cp.dir = startup_info->original_cwd;
|
||||
strvec_pushf(&cp.env_array, "%s=%s",
|
||||
strvec_pushf(&cp.env, "%s=%s",
|
||||
GIT_WORK_TREE_ENVIRONMENT,
|
||||
the_repository->worktree);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
/*
|
||||
|
|
|
@ -301,7 +301,7 @@ static int checkout_worktree(const struct add_opts *opts,
|
|||
strvec_pushl(&cp.args, "reset", "--hard", "--no-recurse-submodules", NULL);
|
||||
if (opts->quiet)
|
||||
strvec_push(&cp.args, "--quiet");
|
||||
strvec_pushv(&cp.env_array, child_env->v);
|
||||
strvec_pushv(&cp.env, child_env->v);
|
||||
return run_command(&cp);
|
||||
}
|
||||
|
||||
|
@ -433,7 +433,7 @@ static int add_worktree(const char *path, const char *refname,
|
|||
strvec_push(&cp.args, "--quiet");
|
||||
}
|
||||
|
||||
strvec_pushv(&cp.env_array, child_env.v);
|
||||
strvec_pushv(&cp.env, child_env.v);
|
||||
ret = run_command(&cp);
|
||||
if (ret)
|
||||
goto done;
|
||||
|
@ -989,9 +989,9 @@ static void check_clean_worktree(struct worktree *wt,
|
|||
validate_no_submodules(wt);
|
||||
|
||||
child_process_init(&cp);
|
||||
strvec_pushf(&cp.env_array, "%s=%s/.git",
|
||||
strvec_pushf(&cp.env, "%s=%s/.git",
|
||||
GIT_DIR_ENVIRONMENT, wt->path);
|
||||
strvec_pushf(&cp.env_array, "%s=%s",
|
||||
strvec_pushf(&cp.env, "%s=%s",
|
||||
GIT_WORK_TREE_ENVIRONMENT, wt->path);
|
||||
strvec_pushl(&cp.args, "status",
|
||||
"--porcelain", "--ignore-submodules=none",
|
||||
|
|
|
@ -1334,7 +1334,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
|
|||
|
||||
strvec_push(&detect.args, ssh);
|
||||
strvec_push(&detect.args, "-G");
|
||||
push_ssh_options(&detect.args, &detect.env_array,
|
||||
push_ssh_options(&detect.args, &detect.env,
|
||||
VARIANT_SSH, port, version, flags);
|
||||
strvec_push(&detect.args, ssh_host);
|
||||
|
||||
|
@ -1342,7 +1342,8 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,
|
|||
}
|
||||
|
||||
strvec_push(&conn->args, ssh);
|
||||
push_ssh_options(&conn->args, &conn->env_array, variant, port, version, flags);
|
||||
push_ssh_options(&conn->args, &conn->env, variant, port, version,
|
||||
flags);
|
||||
strvec_push(&conn->args, ssh_host);
|
||||
}
|
||||
|
||||
|
@ -1404,7 +1405,7 @@ struct child_process *git_connect(int fd[2], const char *url,
|
|||
|
||||
/* remove repo-local variables from the environment */
|
||||
for (var = local_repo_env; *var; var++)
|
||||
strvec_push(&conn->env_array, *var);
|
||||
strvec_push(&conn->env, *var);
|
||||
|
||||
conn->use_shell = 1;
|
||||
conn->in = conn->out = -1;
|
||||
|
@ -1436,7 +1437,7 @@ struct child_process *git_connect(int fd[2], const char *url,
|
|||
transport_check_allowed("file");
|
||||
conn->trace2_child_class = "transport/file";
|
||||
if (version > 0) {
|
||||
strvec_pushf(&conn->env_array,
|
||||
strvec_pushf(&conn->env,
|
||||
GIT_PROTOCOL_ENVIRONMENT "=version=%d",
|
||||
version);
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ no_promisor_pack_found:
|
|||
|
||||
rev_list.git_cmd = 1;
|
||||
if (opt->env)
|
||||
strvec_pushv(&rev_list.env_array, opt->env);
|
||||
strvec_pushv(&rev_list.env, opt->env);
|
||||
rev_list.in = -1;
|
||||
rev_list.no_stdout = 1;
|
||||
if (opt->err_fd)
|
||||
|
|
14
daemon.c
14
daemon.c
|
@ -484,7 +484,7 @@ static int upload_pack(const struct strvec *env)
|
|||
strvec_pushl(&cld.args, "upload-pack", "--strict", NULL);
|
||||
strvec_pushf(&cld.args, "--timeout=%u", timeout);
|
||||
|
||||
strvec_pushv(&cld.env_array, env->v);
|
||||
strvec_pushv(&cld.env, env->v);
|
||||
|
||||
return run_service_command(&cld);
|
||||
}
|
||||
|
@ -494,7 +494,7 @@ static int upload_archive(const struct strvec *env)
|
|||
struct child_process cld = CHILD_PROCESS_INIT;
|
||||
strvec_push(&cld.args, "upload-archive");
|
||||
|
||||
strvec_pushv(&cld.env_array, env->v);
|
||||
strvec_pushv(&cld.env, env->v);
|
||||
|
||||
return run_service_command(&cld);
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ static int receive_pack(const struct strvec *env)
|
|||
struct child_process cld = CHILD_PROCESS_INIT;
|
||||
strvec_push(&cld.args, "receive-pack");
|
||||
|
||||
strvec_pushv(&cld.env_array, env->v);
|
||||
strvec_pushv(&cld.env, env->v);
|
||||
|
||||
return run_service_command(&cld);
|
||||
}
|
||||
|
@ -904,16 +904,16 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
|
|||
char buf[128] = "";
|
||||
struct sockaddr_in *sin_addr = (void *) addr;
|
||||
inet_ntop(addr->sa_family, &sin_addr->sin_addr, buf, sizeof(buf));
|
||||
strvec_pushf(&cld.env_array, "REMOTE_ADDR=%s", buf);
|
||||
strvec_pushf(&cld.env_array, "REMOTE_PORT=%d",
|
||||
strvec_pushf(&cld.env, "REMOTE_ADDR=%s", buf);
|
||||
strvec_pushf(&cld.env, "REMOTE_PORT=%d",
|
||||
ntohs(sin_addr->sin_port));
|
||||
#ifndef NO_IPV6
|
||||
} else if (addr->sa_family == AF_INET6) {
|
||||
char buf[128] = "";
|
||||
struct sockaddr_in6 *sin6_addr = (void *) addr;
|
||||
inet_ntop(AF_INET6, &sin6_addr->sin6_addr, buf, sizeof(buf));
|
||||
strvec_pushf(&cld.env_array, "REMOTE_ADDR=[%s]", buf);
|
||||
strvec_pushf(&cld.env_array, "REMOTE_PORT=%d",
|
||||
strvec_pushf(&cld.env, "REMOTE_ADDR=[%s]", buf);
|
||||
strvec_pushf(&cld.env, "REMOTE_PORT=%d",
|
||||
ntohs(sin6_addr->sin6_port));
|
||||
#endif
|
||||
}
|
||||
|
|
2
editor.c
2
editor.c
|
@ -80,7 +80,7 @@ static int launch_specified_editor(const char *editor, const char *path,
|
|||
|
||||
strvec_pushl(&p.args, editor, realpath.buf, NULL);
|
||||
if (env)
|
||||
strvec_pushv(&p.env_array, (const char **)env);
|
||||
strvec_pushv(&p.env, (const char **)env);
|
||||
p.use_shell = 1;
|
||||
p.trace2_child_class = "editor";
|
||||
if (start_command(&p) < 0) {
|
||||
|
|
2
hook.c
2
hook.c
|
@ -54,7 +54,7 @@ static int pick_next_hook(struct child_process *cp,
|
|||
return 0;
|
||||
|
||||
cp->no_stdin = 1;
|
||||
strvec_pushv(&cp->env_array, hook_cb->options->env.v);
|
||||
strvec_pushv(&cp->env, hook_cb->options->env.v);
|
||||
cp->stdout_to_stderr = 1;
|
||||
cp->trace2_hook_name = hook_cb->hook_name;
|
||||
cp->dir = hook_cb->options->dir;
|
||||
|
|
|
@ -476,9 +476,9 @@ static void run_service(const char **argv, int buffer_input)
|
|||
host = "(none)";
|
||||
|
||||
if (!getenv("GIT_COMMITTER_NAME"))
|
||||
strvec_pushf(&cld.env_array, "GIT_COMMITTER_NAME=%s", user);
|
||||
strvec_pushf(&cld.env, "GIT_COMMITTER_NAME=%s", user);
|
||||
if (!getenv("GIT_COMMITTER_EMAIL"))
|
||||
strvec_pushf(&cld.env_array,
|
||||
strvec_pushf(&cld.env,
|
||||
"GIT_COMMITTER_EMAIL=%s@http.%s", user, host);
|
||||
|
||||
strvec_pushv(&cld.args, argv);
|
||||
|
|
|
@ -838,7 +838,7 @@ static void fill_alternate_refs_command(struct child_process *cmd,
|
|||
}
|
||||
}
|
||||
|
||||
strvec_pushv(&cmd->env_array, (const char **)local_repo_env);
|
||||
strvec_pushv(&cmd->env, (const char **)local_repo_env);
|
||||
cmd->out = -1;
|
||||
}
|
||||
|
||||
|
|
4
pager.c
4
pager.c
|
@ -99,7 +99,7 @@ void prepare_pager_args(struct child_process *pager_process, const char *pager)
|
|||
{
|
||||
strvec_push(&pager_process->args, pager);
|
||||
pager_process->use_shell = 1;
|
||||
setup_pager_env(&pager_process->env_array);
|
||||
setup_pager_env(&pager_process->env);
|
||||
pager_process->trace2_child_class = "pager";
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ void setup_pager(void)
|
|||
/* spawn the pager */
|
||||
prepare_pager_args(&pager_process, pager);
|
||||
pager_process.in = -1;
|
||||
strvec_push(&pager_process.env_array, "GIT_PAGER_IN_USE");
|
||||
strvec_push(&pager_process.env, "GIT_PAGER_IN_USE");
|
||||
if (start_command(&pager_process))
|
||||
return;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ static int fetch_objects(struct repository *repo,
|
|||
child.git_cmd = 1;
|
||||
child.in = -1;
|
||||
if (repo != the_repository)
|
||||
prepare_other_repo_env(&child.env_array, repo->gitdir);
|
||||
prepare_other_repo_env(&child.env, repo->gitdir);
|
||||
strvec_pushl(&child.args, "-c", "fetch.negotiationAlgorithm=noop",
|
||||
"fetch", remote_name, "--no-tags",
|
||||
"--no-write-fetch-head", "--recurse-submodules=no",
|
||||
|
|
|
@ -20,7 +20,7 @@ void child_process_init(struct child_process *child)
|
|||
void child_process_clear(struct child_process *child)
|
||||
{
|
||||
strvec_clear(&child->args);
|
||||
strvec_clear(&child->env_array);
|
||||
strvec_clear(&child->env);
|
||||
}
|
||||
|
||||
struct child_to_clean {
|
||||
|
@ -646,7 +646,7 @@ static void trace_run_command(const struct child_process *cp)
|
|||
sq_quote_buf_pretty(&buf, cp->dir);
|
||||
strbuf_addch(&buf, ';');
|
||||
}
|
||||
trace_add_env(&buf, cp->env_array.v);
|
||||
trace_add_env(&buf, cp->env.v);
|
||||
if (cp->git_cmd)
|
||||
strbuf_addstr(&buf, " git");
|
||||
sq_quote_argv_pretty(&buf, cp->args.v);
|
||||
|
@ -751,7 +751,7 @@ fail_pipe:
|
|||
set_cloexec(null_fd);
|
||||
}
|
||||
|
||||
childenv = prep_childenv(cmd->env_array.v);
|
||||
childenv = prep_childenv(cmd->env.v);
|
||||
atfork_prepare(&as);
|
||||
|
||||
/*
|
||||
|
@ -914,8 +914,9 @@ end_of_spawn:
|
|||
else if (cmd->use_shell)
|
||||
cmd->args.v = prepare_shell_cmd(&nargv, sargv);
|
||||
|
||||
cmd->pid = mingw_spawnvpe(cmd->args.v[0], cmd->args.v, (char**) cmd->env_array.v,
|
||||
cmd->dir, fhin, fhout, fherr);
|
||||
cmd->pid = mingw_spawnvpe(cmd->args.v[0], cmd->args.v,
|
||||
(char**) cmd->env.v,
|
||||
cmd->dir, fhin, fhout, fherr);
|
||||
failed_errno = errno;
|
||||
if (cmd->pid < 0 && (!cmd->silent_exec_failure || errno != ENOENT))
|
||||
error_errno("cannot spawn %s", cmd->args.v[0]);
|
||||
|
@ -1031,7 +1032,7 @@ int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir,
|
|||
cmd.close_object_store = opt & RUN_CLOSE_OBJECT_STORE ? 1 : 0;
|
||||
cmd.dir = dir;
|
||||
if (env)
|
||||
strvec_pushv(&cmd.env_array, (const char **)env);
|
||||
strvec_pushv(&cmd.env, (const char **)env);
|
||||
cmd.trace2_child_class = tr2_class;
|
||||
return run_command(&cmd);
|
||||
}
|
||||
|
@ -1815,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,
|
||||
|
|
|
@ -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,10 +70,10 @@ 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_array;
|
||||
struct strvec env;
|
||||
pid_t pid;
|
||||
|
||||
int trace2_child_id;
|
||||
|
@ -146,7 +146,7 @@ struct child_process {
|
|||
|
||||
#define CHILD_PROCESS_INIT { \
|
||||
.args = STRVEC_INIT, \
|
||||
.env_array = STRVEC_INIT, \
|
||||
.env = STRVEC_INIT, \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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().
|
||||
|
|
18
sequencer.c
18
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;
|
||||
|
@ -1000,7 +1000,7 @@ static int run_git_commit(const char *defmsg,
|
|||
if (is_rebase_i(opts) &&
|
||||
((opts->committer_date_is_author_date && !opts->ignore_date) ||
|
||||
!(!defmsg && (flags & AMEND_MSG))) &&
|
||||
read_env_script(&cmd.env_array)) {
|
||||
read_env_script(&cmd.env)) {
|
||||
const char *gpg_opt = gpg_sign_opt_quoted(opts);
|
||||
|
||||
return error(_(staged_changes_advice),
|
||||
|
@ -1008,12 +1008,12 @@ static int run_git_commit(const char *defmsg,
|
|||
}
|
||||
|
||||
if (opts->committer_date_is_author_date)
|
||||
strvec_pushf(&cmd.env_array, "GIT_COMMITTER_DATE=%s",
|
||||
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
|
||||
opts->ignore_date ?
|
||||
"" :
|
||||
author_date_from_env_array(&cmd.env_array));
|
||||
author_date_from_env(&cmd.env));
|
||||
if (opts->ignore_date)
|
||||
strvec_push(&cmd.env_array, "GIT_AUTHOR_DATE=");
|
||||
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
|
||||
|
||||
strvec_push(&cmd.args, "commit");
|
||||
|
||||
|
@ -3913,7 +3913,7 @@ static int do_merge(struct repository *r,
|
|||
/* Octopus merge */
|
||||
struct child_process cmd = CHILD_PROCESS_INIT;
|
||||
|
||||
if (read_env_script(&cmd.env_array)) {
|
||||
if (read_env_script(&cmd.env)) {
|
||||
const char *gpg_opt = gpg_sign_opt_quoted(opts);
|
||||
|
||||
ret = error(_(staged_changes_advice), gpg_opt, gpg_opt);
|
||||
|
@ -3921,12 +3921,12 @@ static int do_merge(struct repository *r,
|
|||
}
|
||||
|
||||
if (opts->committer_date_is_author_date)
|
||||
strvec_pushf(&cmd.env_array, "GIT_COMMITTER_DATE=%s",
|
||||
strvec_pushf(&cmd.env, "GIT_COMMITTER_DATE=%s",
|
||||
opts->ignore_date ?
|
||||
"" :
|
||||
author_date_from_env_array(&cmd.env_array));
|
||||
author_date_from_env(&cmd.env));
|
||||
if (opts->ignore_date)
|
||||
strvec_push(&cmd.env_array, "GIT_AUTHOR_DATE=");
|
||||
strvec_push(&cmd.env, "GIT_AUTHOR_DATE=");
|
||||
|
||||
cmd.git_cmd = 1;
|
||||
strvec_push(&cmd.args, "merge");
|
||||
|
|
38
submodule.c
38
submodule.c
|
@ -711,15 +711,15 @@ void show_submodule_inline_diff(struct diff_options *o, const char *path,
|
|||
if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
|
||||
strvec_push(&cp.args, oid_to_hex(new_oid));
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
|
||||
if (!is_directory(path)) {
|
||||
/* fall back to absorbed git dir, if any */
|
||||
if (!sub)
|
||||
goto done;
|
||||
cp.dir = sub->gitdir;
|
||||
strvec_push(&cp.env_array, GIT_DIR_ENVIRONMENT "=.");
|
||||
strvec_push(&cp.env_array, GIT_WORK_TREE_ENVIRONMENT "=.");
|
||||
strvec_push(&cp.env, GIT_DIR_ENVIRONMENT "=.");
|
||||
strvec_push(&cp.env, GIT_WORK_TREE_ENVIRONMENT "=.");
|
||||
}
|
||||
|
||||
if (start_command(&cp)) {
|
||||
|
@ -1020,7 +1020,7 @@ static int submodule_has_commits(struct repository *r,
|
|||
oid_array_for_each_unique(commits, append_oid_to_argv, &cp.args);
|
||||
strvec_pushl(&cp.args, "--not", "--all", NULL);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.dir = path;
|
||||
|
@ -1061,7 +1061,7 @@ static int submodule_needs_pushing(struct repository *r,
|
|||
oid_array_for_each_unique(commits, append_oid_to_argv, &cp.args);
|
||||
strvec_pushl(&cp.args, "--not", "--remotes", "-n", "1" , NULL);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.out = -1;
|
||||
|
@ -1147,7 +1147,7 @@ static int push_submodule(const char *path,
|
|||
strvec_push(&cp.args, rs->raw[i]);
|
||||
}
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.dir = path;
|
||||
|
@ -1178,7 +1178,7 @@ static void submodule_push_check(const char *path, const char *head,
|
|||
for (i = 0; i < rs->raw_nr; i++)
|
||||
strvec_push(&cp.args, rs->raw[i]);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.no_stdout = 1;
|
||||
|
@ -1679,7 +1679,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
|
|||
|
||||
child_process_init(cp);
|
||||
cp->dir = task->repo->gitdir;
|
||||
prepare_submodule_repo_env_in_gitdir(&cp->env_array);
|
||||
prepare_submodule_repo_env_in_gitdir(&cp->env);
|
||||
cp->git_cmd = 1;
|
||||
strvec_init(&cp->args);
|
||||
if (task->git_args.nr)
|
||||
|
@ -1709,7 +1709,7 @@ static int get_next_submodule(struct child_process *cp, struct strbuf *err,
|
|||
spf->prefix, task->sub->path);
|
||||
|
||||
child_process_init(cp);
|
||||
prepare_submodule_repo_env_in_gitdir(&cp->env_array);
|
||||
prepare_submodule_repo_env_in_gitdir(&cp->env);
|
||||
cp->git_cmd = 1;
|
||||
cp->dir = task->repo->gitdir;
|
||||
|
||||
|
@ -1883,7 +1883,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
|
|||
if (ignore_untracked)
|
||||
strvec_push(&cp.args, "-uno");
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.out = -1;
|
||||
|
@ -1955,7 +1955,7 @@ int submodule_uses_gitfile(const char *path)
|
|||
"submodule", "foreach", "--quiet", "--recursive",
|
||||
"test -f .git", NULL);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.no_stderr = 1;
|
||||
|
@ -1998,7 +1998,7 @@ int bad_to_remove_submodule(const char *path, unsigned flags)
|
|||
if (!(flags & SUBMODULE_REMOVAL_IGNORE_IGNORED_UNTRACKED))
|
||||
strvec_push(&cp.args, "--ignored");
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
cp.out = -1;
|
||||
|
@ -2053,7 +2053,7 @@ static int submodule_has_dirty_index(const struct submodule *sub)
|
|||
{
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
|
||||
cp.git_cmd = 1;
|
||||
strvec_pushl(&cp.args, "diff-index", "--quiet",
|
||||
|
@ -2070,7 +2070,7 @@ static int submodule_has_dirty_index(const struct submodule *sub)
|
|||
static void submodule_reset_index(const char *path)
|
||||
{
|
||||
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.no_stdin = 1;
|
||||
|
@ -2154,7 +2154,7 @@ int submodule_move_head(const char *path,
|
|||
}
|
||||
}
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
|
||||
cp.git_cmd = 1;
|
||||
cp.no_stdin = 1;
|
||||
|
@ -2192,7 +2192,7 @@ int submodule_move_head(const char *path,
|
|||
cp.no_stdin = 1;
|
||||
cp.dir = path;
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
strvec_pushl(&cp.args, "update-ref", "HEAD",
|
||||
"--no-deref", new_head, NULL);
|
||||
|
||||
|
@ -2375,7 +2375,7 @@ void absorb_git_dir_into_superproject(const char *path,
|
|||
strvec_pushl(&cp.args, "--super-prefix", sb.buf,
|
||||
"submodule--helper",
|
||||
"absorb-git-dirs", NULL);
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
if (run_command(&cp))
|
||||
die(_("could not recurse into submodule '%s'"), path);
|
||||
|
||||
|
@ -2408,8 +2408,8 @@ int get_superproject_working_tree(struct strbuf *buf)
|
|||
subpath = relative_path(cwd, one_up.buf, &sb);
|
||||
strbuf_release(&one_up);
|
||||
|
||||
prepare_submodule_repo_env(&cp.env_array);
|
||||
strvec_pop(&cp.env_array);
|
||||
prepare_submodule_repo_env(&cp.env);
|
||||
strvec_pop(&cp.env);
|
||||
|
||||
strvec_pushl(&cp.args, "--literal-pathspecs", "-C", "..",
|
||||
"ls-files", "-z", "--stage", "--full-name", "--",
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -390,7 +390,7 @@ int cmd__run_command(int argc, const char **argv)
|
|||
while (!strcmp(argv[1], "env")) {
|
||||
if (!argv[2])
|
||||
die("env specifier without a value");
|
||||
strvec_push(&proc.env_array, argv[2]);
|
||||
strvec_push(&proc.env, argv[2]);
|
||||
argv += 2;
|
||||
argc -= 2;
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ static char *apply_command(struct conf_info *conf, const char *arg)
|
|||
strbuf_replace(&cmd, TRAILER_ARG_STRING, arg);
|
||||
strvec_push(&cp.args, cmd.buf);
|
||||
}
|
||||
strvec_pushv(&cp.env_array, (const char **)local_repo_env);
|
||||
strvec_pushv(&cp.env, (const char **)local_repo_env);
|
||||
cp.no_stdin = 1;
|
||||
cp.use_shell = 1;
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ static struct child_process *get_helper(struct transport *transport)
|
|||
helper->silent_exec_failure = 1;
|
||||
|
||||
if (have_git_dir())
|
||||
strvec_pushf(&helper->env_array, "%s=%s",
|
||||
strvec_pushf(&helper->env, "%s=%s",
|
||||
GIT_DIR_ENVIRONMENT, get_git_dir());
|
||||
|
||||
helper->trace2_child_class = helper->args.v[0]; /* "remote-<name>" */
|
||||
|
|
|
@ -981,7 +981,7 @@ static void wt_longstatus_print_submodule_summary(struct wt_status *s, int uncom
|
|||
struct strbuf summary = STRBUF_INIT;
|
||||
char *summary_content;
|
||||
|
||||
strvec_pushf(&sm_summary.env_array, "GIT_INDEX_FILE=%s", s->index_file);
|
||||
strvec_pushf(&sm_summary.env, "GIT_INDEX_FILE=%s", s->index_file);
|
||||
|
||||
strvec_push(&sm_summary.args, "submodule");
|
||||
strvec_push(&sm_summary.args, "summary");
|
||||
|
|
Загрузка…
Ссылка в новой задаче