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
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-19 04:47:55 +0300
committerJunio C Hamano <gitster@pobox.com>2017-09-19 04:47:55 +0300
commitdf80c5760c947f2013df86f52d0a5103d07958a2 (patch)
tree9cde7e61d93b700e2f6cc000f59321c597675778
parentdaafb5062ca7f0e02754ddaa5a5334b07fe9bba1 (diff)
parent121e43fa53ca6d874aa3e5a7664c9b769f2cbfa6 (diff)
Merge branch 'nm/pull-submodule-recurse-config'
"git -c submodule.recurse=yes pull" did not work as if the "--recurse-submodules" option was given from the command line. This has been corrected. * nm/pull-submodule-recurse-config: pull: honor submodule.recurse config option pull: fix cli and config option parsing order
-rw-r--r--builtin/pull.c8
-rwxr-xr-xt/t5572-pull-submodule.sh32
2 files changed, 38 insertions, 2 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 7fe281414e..6f772e8a22 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -325,6 +325,10 @@ static int git_pull_config(const char *var, const char *value, void *cb)
if (!strcmp(var, "rebase.autostash")) {
config_autostash = git_config_bool(var, value);
return 0;
+ } else if (!strcmp(var, "submodule.recurse")) {
+ recurse_submodules = git_config_bool(var, value) ?
+ RECURSE_SUBMODULES_ON : RECURSE_SUBMODULES_OFF;
+ return 0;
}
return git_default_config(var, value, cb);
}
@@ -815,6 +819,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 +831,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");
diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh
index 077eb07e11..321bd37deb 100755
--- a/t/t5572-pull-submodule.sh
+++ b/t/t5572-pull-submodule.sh
@@ -65,6 +65,38 @@ test_expect_success 'recursive pull updates working tree' '
test_path_is_file super/sub/merge_strategy.t
'
+test_expect_success "submodule.recurse option triggers recursive pull" '
+ test_commit -C child merge_strategy_2 &&
+ git -C parent submodule update --remote &&
+ git -C parent add sub &&
+ git -C parent commit -m "update submodule" &&
+
+ git -C super -c submodule.recurse pull --no-rebase &&
+ test_path_is_file super/sub/merge_strategy_2.t
+'
+
+test_expect_success " --[no-]recurse-submodule and submodule.recurse" '
+ test_commit -C child merge_strategy_3 &&
+ git -C parent submodule update --remote &&
+ git -C parent add sub &&
+ git -C parent commit -m "update submodule" &&
+
+ git -C super -c submodule.recurse pull --no-recurse-submodules --no-rebase &&
+ test_path_is_missing super/sub/merge_strategy_3.t &&
+ git -C super -c submodule.recurse=false pull --recurse-submodules --no-rebase &&
+ test_path_is_file super/sub/merge_strategy_3.t &&
+
+ test_commit -C child merge_strategy_4 &&
+ git -C parent submodule update --remote &&
+ git -C parent add sub &&
+ git -C parent commit -m "update submodule" &&
+
+ git -C super -c submodule.recurse=false pull --no-recurse-submodules --no-rebase &&
+ test_path_is_missing super/sub/merge_strategy_4.t &&
+ git -C super -c submodule.recurse=true pull --recurse-submodules --no-rebase &&
+ test_path_is_file super/sub/merge_strategy_4.t
+'
+
test_expect_success 'recursive rebasing pull' '
# change upstream
test_commit -C child rebase_strategy &&