Merge branch 'jk/submodule-c-credential'

An earlier addition of "sanitize_submodule_env" with 14111fc4 (git:
submodule honor -c credential.* from command line, 2016-02-29)
turned out to be a convoluted no-op; implement what it wanted to do
correctly, and stop filtering settings given via "git -c var=val".

* jk/submodule-c-credential:
  submodule: stop sanitizing config options
  submodule: use prepare_submodule_repo_env consistently
  submodule--helper: move config-sanitizing to submodule.c
  submodule: export sanitized GIT_CONFIG_PARAMETERS
  t5550: break submodule config test into multiple sub-tests
  t5550: fix typo in $HTTPD_URL
This commit is contained in:
Junio C Hamano
2016-05-17 14:38:25 -07:00
6 changed files with 63 additions and 103 deletions

View File

@ -13,6 +13,7 @@
#include "argv-array.h"
#include "blob.h"
#include "thread-utils.h"
#include "quote.h"
static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
static int parallel_jobs = 1;
@ -414,7 +415,7 @@ static int submodule_needs_pushing(const char *path, const unsigned char sha1[20
argv[1] = sha1_to_hex(sha1);
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.out = -1;
@ -501,7 +502,7 @@ static int push_submodule(const char *path)
const char *argv[] = {"push", NULL};
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.dir = path;
@ -547,7 +548,7 @@ static int is_submodule_commit_present(const char *path, unsigned char sha1[20])
argv[3] = sha1_to_hex(sha1);
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.dir = path;
@ -730,7 +731,7 @@ static int get_next_submodule(struct child_process *cp,
if (is_directory(git_dir)) {
child_process_init(cp);
cp->dir = strbuf_detach(&submodule_path, NULL);
cp->env = local_repo_env;
prepare_submodule_repo_env(&cp->env_array);
cp->git_cmd = 1;
if (!spf->quiet)
strbuf_addf(err, "Fetching submodule %s%s\n",
@ -845,7 +846,7 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
argv[2] = "-uno";
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.out = -1;
@ -906,7 +907,7 @@ int submodule_uses_gitfile(const char *path)
/* Now test that all nested submodules use a gitfile too */
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.no_stderr = 1;
@ -939,7 +940,7 @@ int ok_to_remove_submodule(const char *path)
return 0;
cp.argv = argv;
cp.env = local_repo_env;
prepare_submodule_repo_env(&cp.env_array);
cp.git_cmd = 1;
cp.no_stdin = 1;
cp.out = -1;
@ -1150,3 +1151,13 @@ int parallel_submodules(void)
{
return parallel_jobs;
}
void prepare_submodule_repo_env(struct argv_array *out)
{
const char * const *var;
for (var = local_repo_env; *var; var++) {
if (strcmp(*var, CONFIG_DATA_ENVIRONMENT))
argv_array_push(out, *var);
}
}