summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2010-03-26 23:53:57 +0100
committerJunio C Hamano <gitster@pobox.com>2010-03-28 09:48:25 -0700
commit8b1fa778676ae94f7a6d4113fa90947b548154dd (patch)
treeebdd33abc21f7dc32fa413bdf6b77b651c0daeda /git.c
parentf1ba1c90e1704e937ff59ee510a8d46a5ab52a1a (diff)
downloadgit-8b1fa778676ae94f7a6d4113fa90947b548154dd.tar.gz
Allow passing of configuration parameters in the command line
The values passed this way will override whatever is defined in the config files. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r--git.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/git.c b/git.c
index 6bae30545b..99f036302a 100644
--- a/git.c
+++ b/git.c
@@ -8,6 +8,7 @@ const char git_usage_string[] =
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]\n"
" [-p|--paginate|--no-pager] [--no-replace-objects]\n"
" [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]\n"
+ " [-c name=value\n"
" [--help] COMMAND [ARGS]";
const char git_more_info_string[] =
@@ -130,6 +131,14 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
setenv(GIT_DIR_ENVIRONMENT, getcwd(git_dir, sizeof(git_dir)), 0);
if (envchanged)
*envchanged = 1;
+ } else if (!strcmp(cmd, "-c")) {
+ if (*argc < 2) {
+ fprintf(stderr, "-c expects a configuration string\n" );
+ usage(git_usage_string);
+ }
+ git_config_parse_parameter((*argv)[1]);
+ (*argv)++;
+ (*argc)--;
} else {
fprintf(stderr, "Unknown option: %s\n", cmd);
usage(git_usage_string);