{"thread":{"id":"46711","subject":"[PATCHv3 0/2] fix recurse.submodule config for git pull","startedAt":"2017-09-06T06:47:03Z","lastAt":"2017-09-06T07:03:36Z","messageCount":3,"participants":["Nicolas Morey-Chaisemartin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"327636","messageId":"884cd3b0-7eeb-b711-2c7f-f93a57a009ee@morey-chaisemartin.com","threadId":"46711","inReplyTo":null,"subject":"[PATCHv3 0/2] fix recurse.submodule config for git pull","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nicolas@morey-chaisemartin.com","sentAt":"2017-09-06T06:46:56Z","receivedAt":"2017-09-06T06:47:03Z","isPatch":false,"sender":{"key":"devel-git@morey-chaisemartin.com","avatar":"https://avatars.githubusercontent.com/u/108326?v=4"},"body":"Changes since v2:\n- Add a patch that fixes the option parsing order (parse config before cli, not the other way around)\n- Enhance the tests to check --recurse-submodule and submodule.recurse combinations\n\nNicolas Morey-Chaisemartin (2):\n  pull: fix cli and config option parsing order\n  pull: honor submodule.recurse config option\n\n builtin/pull.c            |  8 ++++++--\n t/t5572-pull-submodule.sh | 32 ++++++++++++++++++++++++++++++++\n 2 files changed, 38 insertions(+), 2 deletions(-)\n\n-- \n2.14.1.461.g503560879\n\n"},{"id":"327637","messageId":"ff1869cf-cee3-bf28-7cb0-ac8821e25887@morey-chaisemartin.com","threadId":"46711","inReplyTo":"884cd3b0-7eeb-b711-2c7f-f93a57a009ee@morey-chaisemartin.com","subject":"[PATCHv3 1/2] pull: fix cli and config option parsing order","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nicolas@morey-chaisemartin.com","sentAt":"2017-09-06T06:48:06Z","receivedAt":"2017-09-06T06:58:15Z","isPatch":false,"sender":{"key":"devel-git@morey-chaisemartin.com","avatar":"https://avatars.githubusercontent.com/u/108326?v=4"},"body":"pull parses first the cli options and then the config option.\nThe expected behavior is the other way around, so that config\noptions can not override the cli ones.\n\nThis patch changes the parsing order so config options are\nparsed first.\n\nSigned-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>\n---\n builtin/pull.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 7fe281414..9ef1ab501 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -815,6 +815,8 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (!getenv(\"GIT_REFLOG_ACTION\"))\n \t\tset_reflog_message(argc, argv);\n \n+\tgit_config(git_pull_config, NULL);\n+\n \targc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);\n \n \tparse_repo_refspecs(argc, argv, &repo, &refspecs);\n@@ -825,8 +827,6 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tif (opt_rebase < 0)\n \t\topt_rebase = config_get_rebase();\n \n-\tgit_config(git_pull_config, NULL);\n-\n \tif (read_cache_unmerged())\n \t\tdie_resolve_conflict(\"pull\");\n \n-- \n2.14.1.461.g503560879\n\n\n"},{"id":"327638","messageId":"0b4728b5-7a07-6a0f-5906-db04368c6686@morey-chaisemartin.com","threadId":"46711","inReplyTo":"884cd3b0-7eeb-b711-2c7f-f93a57a009ee@morey-chaisemartin.com","subject":"[PATCHv3 2/2] pull: honor submodule.recurse config option","fromName":"Nicolas Morey-Chaisemartin","fromEmail":"nicolas@morey-chaisemartin.com","sentAt":"2017-09-06T06:48:09Z","receivedAt":"2017-09-06T07:03:36Z","isPatch":false,"sender":{"key":"devel-git@morey-chaisemartin.com","avatar":"https://avatars.githubusercontent.com/u/108326?v=4"},"body":"\"git pull\" supports a --recurse-submodules option but does not parse the\nsubmodule.recurse configuration item to set the default for that option.\nMeanwhile \"git fetch\" does support submodule.recurse, producing\nconfusing behavior: when submodule.recurse is enabled, \"git pull\"\nrecursively fetches submodules but does not update them after fetch.\n\nHandle submodule.recurse in \"git pull\" to fix this.\n\nReported-by: Magnus Homann <magnus@homann.se>\nSigned-off-by: Nicolas Morey-Chaisemartin <nicolas@morey-chaisemartin.com>\n---\n builtin/pull.c            |  4 ++++\n t/t5572-pull-submodule.sh | 32 ++++++++++++++++++++++++++++++++\n 2 files changed, 36 insertions(+)\n\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 9ef1ab501..6f772e8a2 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -325,6 +325,10 @@ static int git_pull_config(const char *var, const char *value, void *cb)\n \tif (!strcmp(var, \"rebase.autostash\")) {\n \t\tconfig_autostash = git_config_bool(var, value);\n \t\treturn 0;\n+\t} else if (!strcmp(var, \"submodule.recurse\")) {\n+\t\trecurse_submodules = git_config_bool(var, value) ?\n+\t\t\tRECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;\n+\t\treturn 0;\n \t}\n \treturn git_default_config(var, value, cb);\n }\ndiff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh\nindex 077eb07e1..321bd37de 100755\n--- a/t/t5572-pull-submodule.sh\n+++ b/t/t5572-pull-submodule.sh\n@@ -65,6 +65,38 @@ test_expect_success 'recursive pull updates working tree' '\n \ttest_path_is_file super/sub/merge_strategy.t\n '\n \n+test_expect_success \"submodule.recurse option triggers recursive pull\" '\n+\ttest_commit -C child merge_strategy_2 &&\n+\tgit -C parent submodule update --remote &&\n+\tgit -C parent add sub &&\n+\tgit -C parent commit -m \"update submodule\" &&\n+\n+\tgit -C super -c submodule.recurse pull --no-rebase &&\n+\ttest_path_is_file super/sub/merge_strategy_2.t\n+'\n+\n+test_expect_success \" --[no-]recurse-submodule and submodule.recurse\" '\n+\ttest_commit -C child merge_strategy_3 &&\n+\tgit -C parent submodule update --remote &&\n+\tgit -C parent add sub &&\n+\tgit -C parent commit -m \"update submodule\" &&\n+\n+\tgit -C super -c submodule.recurse pull --no-recurse-submodules --no-rebase &&\n+\ttest_path_is_missing super/sub/merge_strategy_3.t &&\n+\tgit -C super -c submodule.recurse=false pull --recurse-submodules --no-rebase &&\n+\ttest_path_is_file super/sub/merge_strategy_3.t &&\n+\n+\ttest_commit -C child merge_strategy_4 &&\n+\tgit -C parent submodule update --remote &&\n+\tgit -C parent add sub &&\n+\tgit -C parent commit -m \"update submodule\" &&\n+\n+\tgit -C super -c submodule.recurse=false pull --no-recurse-submodules --no-rebase &&\n+\ttest_path_is_missing super/sub/merge_strategy_4.t &&\n+\tgit -C super -c submodule.recurse=true pull --recurse-submodules --no-rebase &&\n+\ttest_path_is_file super/sub/merge_strategy_4.t\n+'\n+\n test_expect_success 'recursive rebasing pull' '\n \t# change upstream\n \ttest_commit -C child rebase_strategy &&\n-- \n2.14.1.461.g503560879\n\n"}]}