Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2021-04-29 15:55:34 +0300
committerJunio C Hamano <gitster@pobox.com>2021-04-30 03:46:53 +0300
commitc331551ccf9a4c8922ff5d2987eed9e218479000 (patch)
tree5a629d63d2470957f4915d413b8da85f68775286 /git.c
parent9152904c1162afaf9ce0305d1988d1450dc80da7 (diff)
git: support separate arg for `--config-env`'s value
While not documented as such, many of the top-level options like `--git-dir` and `--work-tree` support two syntaxes: they accept both an equals sign between option and its value, and they do support option and value as two separate arguments. The recently added `--config-env` option only supports the syntax with an equals sign. Mitigate this inconsistency by accepting both syntaxes and add tests to verify both work. Signed-off-by: Patrick Steinhardt <ps@pks.im> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r--git.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/git.c b/git.c
index 2f548821d6..dd8c6ca51a 100644
--- a/git.c
+++ b/git.c
@@ -255,6 +255,14 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
git_config_push_parameter((*argv)[1]);
(*argv)++;
(*argc)--;
+ } else if (!strcmp(cmd, "--config-env")) {
+ if (*argc < 2) {
+ fprintf(stderr, _("no config key given for --config-env\n" ));
+ usage(git_usage_string);
+ }
+ git_config_push_env((*argv)[1]);
+ (*argv)++;
+ (*argc)--;
} else if (skip_prefix(cmd, "--config-env=", &cmd)) {
git_config_push_env(cmd);
} else if (!strcmp(cmd, "--literal-pathspecs")) {