summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-30 20:19:14 -0700
committerJunio C Hamano <gitster@pobox.com>2011-05-30 20:19:14 -0700
commit1f9a980636d39c08c1cf1c13a6e6584d9d039e0e (patch)
tree97f906828fd6ad4166101e7e5d86a7a4b9671079 /git.c
parentfb674d767180354d9ad3e69f1d41bee98df6bfe9 (diff)
parent73546c085d49694c5e54b421f80bde6bc25006fb (diff)
downloadgit-1f9a980636d39c08c1cf1c13a6e6584d9d039e0e.tar.gz
Merge branch 'jk/maint-config-alias-fix'
* jk/maint-config-alias-fix: handle_options(): do not miscount how many arguments were used config: always parse GIT_CONFIG_PARAMETERS during git_config git_config: don't peek at global config_parameters config: make environment parsing routines static Conflicts: config.c
Diffstat (limited to 'git.c')
-rw-r--r--git.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/git.c b/git.c
index a5ef3c69ff..89721d420a 100644
--- a/git.c
+++ b/git.c
@@ -66,7 +66,7 @@ static void commit_pager_choice(void) {
static int handle_options(const char ***argv, int *argc, int *envchanged)
{
- int handled = 0;
+ const char **orig_argv = *argv;
while (*argc > 0) {
const char *cmd = (*argv)[0];
@@ -122,7 +122,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
*envchanged = 1;
(*argv)++;
(*argc)--;
- handled++;
} else if (!prefixcmp(cmd, "--git-dir=")) {
setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
if (envchanged)
@@ -162,9 +161,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
(*argv)++;
(*argc)--;
- handled++;
}
- return handled;
+ return (*argv) - orig_argv;
}
static int handle_alias(int *argcp, const char ***argv)