diff options
author | Jonathan Tan <jonathantanmy@google.com> | 2021-06-17 19:13:25 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-06-28 18:58:01 +0200 |
commit | d1fa94356ddd2a81348532d49030cd08d0df6a4d (patch) | |
tree | aa09a8f24a0f25e20d184030ee2c3dde782e9b4a /run-command.c | |
parent | submodule: refrain from filtering GIT_CONFIG_COUNT (diff) | |
download | git-d1fa94356ddd2a81348532d49030cd08d0df6a4d.tar.xz git-d1fa94356ddd2a81348532d49030cd08d0df6a4d.zip |
run-command: refactor subprocess env preparation
submodule.c has functionality that prepares the environment for running
a subprocess in a new repo. The lazy-fetching code (used in partial
clones) will need this in a subsequent commit, so move it to a more
central location.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'run-command.c')
-rw-r--r-- | run-command.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/run-command.c b/run-command.c index be6bc128cd..549a94a6a4 100644 --- a/run-command.c +++ b/run-command.c @@ -1892,3 +1892,15 @@ int run_auto_maintenance(int quiet) return run_command(&maint); } + +void prepare_other_repo_env(struct strvec *env_array, 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_pushf(env_array, "%s=%s", GIT_DIR_ENVIRONMENT, new_git_dir); +} |