pass "git -c foo=bar" params through environment

Git uses the "-c foo=bar" parameters to set a config
variable for a single git invocation. We currently do this
by making a list in the current process and consulting that
list in git_config.

This works fine for built-ins, but the config changes are
silently ignored by subprocesses, including dashed externals
and invocations to "git config" from shell scripts.

This patch instead puts them in an environment variable
which we consult when looking at config (both internally and
via calls "git config").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2010-08-23 15:16:00 -04:00
committed by Junio C Hamano
parent 64fdc08dac
commit 2b64fc894d
3 changed files with 58 additions and 4 deletions

2
git.c
View File

@ -136,7 +136,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
fprintf(stderr, "-c expects a configuration string\n" );
usage(git_usage_string);
}
git_config_parse_parameter((*argv)[1]);
git_config_push_parameter((*argv)[1]);
(*argv)++;
(*argc)--;
} else {