pull: fix cli and config option parsing order
authorNicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Wed, 6 Sep 2017 06:48:06 +0000 (08:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Thu, 7 Sep 2017 00:51:29 +0000 (09:51 +0900)
pull parses first the cli options and then the config option.
The expected behavior is the other way around, so that config
options can not override the cli ones.

This patch changes the parsing order so config options are
parsed first.

Signed-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pull.c
index 7fe281414eceaae64926caca2b6194c9fcfef299..9ef1ab501525b3ea2944da8bbb1df8f2b3c620c8 100644 (file)
@@ -815,6 +815,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
        if (!getenv("GIT_REFLOG_ACTION"))
                set_reflog_message(argc, argv);
 
+       git_config(git_pull_config, NULL);
+
        argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
 
        parse_repo_refspecs(argc, argv, &repo, &refspecs);
@@ -825,8 +827,6 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
        if (opt_rebase < 0)
                opt_rebase = config_get_rebase();
 
-       git_config(git_pull_config, NULL);
-
        if (read_cache_unmerged())
                die_resolve_conflict("pull");