git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv3 1/2] pull: fix cli and config option parsing order

From
Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>
Date
Sep 6, 2017, 06:48 UTC
Message-ID
<ff1869cf-cee3-bf28-7cb0-ac8821e25887@morey-chaisemartin.com>
In-Reply-To
<884cd3b0-7eeb-b711-2c7f-f93a57a009ee@morey-chaisemartin.com>

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>
---
 builtin/pull.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/pull.c b/builtin/pull.c
index 7fe281414..9ef1ab501 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -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");
 
-- 
2.14.1.461.g503560879
Previous: Nicolas Morey-ChaisemartinNext: Nicolas Morey-Chaisemartin
Message 2 of 3 in “[PATCHv3 0/2] fix recurse.submodule config for git pull”
  1. Nicolas Morey-ChaisemartinSep 6, 2017
  2. 1/2 pull: fix cli and config option parsing orderNicolas Morey-Chaisemartin, Sep 6, 2017
  3. 2/2 pull: honor submodule.recurse config optionNicolas Morey-Chaisemartin, Sep 6, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.