зеркало из https://github.com/microsoft/git.git
Merge branch 'gc/pull-recurse-submodules'
"git pull" without "--recurse-submodules=<arg>" made submodule.recurse take precedence over fetch.recurseSubmodules by mistake, which has been corrected. * gc/pull-recurse-submodules: pull: do not let submodule.recurse override fetch.recurseSubmodules
This commit is contained in:
Коммит
ed54e1b31a
|
@ -72,6 +72,7 @@ static const char * const pull_usage[] = {
|
||||||
static int opt_verbosity;
|
static int opt_verbosity;
|
||||||
static char *opt_progress;
|
static char *opt_progress;
|
||||||
static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
|
static int recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
|
||||||
|
static int recurse_submodules_cli = RECURSE_SUBMODULES_DEFAULT;
|
||||||
|
|
||||||
/* Options passed to git-merge or git-rebase */
|
/* Options passed to git-merge or git-rebase */
|
||||||
static enum rebase_type opt_rebase = -1;
|
static enum rebase_type opt_rebase = -1;
|
||||||
|
@ -120,7 +121,7 @@ static struct option pull_options[] = {
|
||||||
N_("force progress reporting"),
|
N_("force progress reporting"),
|
||||||
PARSE_OPT_NOARG),
|
PARSE_OPT_NOARG),
|
||||||
OPT_CALLBACK_F(0, "recurse-submodules",
|
OPT_CALLBACK_F(0, "recurse-submodules",
|
||||||
&recurse_submodules, N_("on-demand"),
|
&recurse_submodules_cli, N_("on-demand"),
|
||||||
N_("control for recursive fetching of submodules"),
|
N_("control for recursive fetching of submodules"),
|
||||||
PARSE_OPT_OPTARG, option_fetch_parse_recurse_submodules),
|
PARSE_OPT_OPTARG, option_fetch_parse_recurse_submodules),
|
||||||
|
|
||||||
|
@ -536,8 +537,8 @@ static int run_fetch(const char *repo, const char **refspecs)
|
||||||
strvec_push(&args, opt_tags);
|
strvec_push(&args, opt_tags);
|
||||||
if (opt_prune)
|
if (opt_prune)
|
||||||
strvec_push(&args, opt_prune);
|
strvec_push(&args, opt_prune);
|
||||||
if (recurse_submodules != RECURSE_SUBMODULES_DEFAULT)
|
if (recurse_submodules_cli != RECURSE_SUBMODULES_DEFAULT)
|
||||||
switch (recurse_submodules) {
|
switch (recurse_submodules_cli) {
|
||||||
case RECURSE_SUBMODULES_ON:
|
case RECURSE_SUBMODULES_ON:
|
||||||
strvec_push(&args, "--recurse-submodules=on");
|
strvec_push(&args, "--recurse-submodules=on");
|
||||||
break;
|
break;
|
||||||
|
@ -1001,6 +1002,9 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
|
argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
|
||||||
|
|
||||||
|
if (recurse_submodules_cli != RECURSE_SUBMODULES_DEFAULT)
|
||||||
|
recurse_submodules = recurse_submodules_cli;
|
||||||
|
|
||||||
if (cleanup_arg)
|
if (cleanup_arg)
|
||||||
/*
|
/*
|
||||||
* this only checks the validity of cleanup_arg; we don't need
|
* this only checks the validity of cleanup_arg; we don't need
|
||||||
|
|
|
@ -107,6 +107,32 @@ test_expect_success " --[no-]recurse-submodule and submodule.recurse" '
|
||||||
test_path_is_file super/sub/merge_strategy_4.t
|
test_path_is_file super/sub/merge_strategy_4.t
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success "fetch.recurseSubmodules option triggers recursive fetch (but not recursive update)" '
|
||||||
|
test_commit -C child merge_strategy_5 &&
|
||||||
|
# Omit the parent commit, otherwise this passes with the
|
||||||
|
# default "pull" behavior.
|
||||||
|
|
||||||
|
git -C super -c fetch.recursesubmodules=true pull --no-rebase &&
|
||||||
|
# Check that the submodule commit was fetched
|
||||||
|
sub_oid=$(git -C child rev-parse HEAD) &&
|
||||||
|
git -C super/sub cat-file -e $sub_oid &&
|
||||||
|
# Check that the submodule worktree did not update
|
||||||
|
! test_path_is_file super/sub/merge_strategy_5.t
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success "fetch.recurseSubmodules takes precedence over submodule.recurse" '
|
||||||
|
test_commit -C child merge_strategy_6 &&
|
||||||
|
# Omit the parent commit, otherwise this passes with the
|
||||||
|
# default "pull" behavior.
|
||||||
|
|
||||||
|
git -C super -c submodule.recurse=false -c fetch.recursesubmodules=true pull --no-rebase &&
|
||||||
|
# Check that the submodule commit was fetched
|
||||||
|
sub_oid=$(git -C child rev-parse HEAD) &&
|
||||||
|
git -C super/sub cat-file -e $sub_oid &&
|
||||||
|
# Check that the submodule worktree did not update
|
||||||
|
! test_path_is_file super/sub/merge_strategy_6.t
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'pull --rebase --recurse-submodules (remote superproject submodule changes, local submodule changes)' '
|
test_expect_success 'pull --rebase --recurse-submodules (remote superproject submodule changes, local submodule changes)' '
|
||||||
# This tests the following scenario :
|
# This tests the following scenario :
|
||||||
# - local submodule has new commits
|
# - local submodule has new commits
|
||||||
|
|
Загрузка…
Ссылка в новой задаче