From b58a68c1c1874ff155699d82947c9f026f431cb3 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Fri, 17 Mar 2017 10:22:54 -0700 Subject: setup: allow for prefix to be passed to git commands In a future patch child processes which act on submodules need a little more context about the original command that was invoked. This patch teaches git to use the prefix stored in `GIT_INTERNAL_TOPLEVEL_PREFIX` instead of the prefix that was potentally found during the git directory setup process. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- setup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'setup.c') diff --git a/setup.c b/setup.c index 967f289f1..56cd68ba9 100644 --- a/setup.c +++ b/setup.c @@ -939,9 +939,14 @@ static const char *setup_git_directory_gently_1(int *nongit_ok) const char *setup_git_directory_gently(int *nongit_ok) { - const char *prefix; + const char *prefix, *env_prefix; prefix = setup_git_directory_gently_1(nongit_ok); + env_prefix = getenv(GIT_TOPLEVEL_PREFIX_ENVIRONMENT); + + if (env_prefix) + prefix = env_prefix; + if (prefix) setenv(GIT_PREFIX_ENVIRONMENT, prefix, 1); else -- cgit v1.2.1