Merge branch 'sb/checkout-recurse-submodules' into maint
"git checkout --recurse-submodules" did not quite work with a submodule that itself has submodules. * sb/checkout-recurse-submodules: submodule: properly recurse for read-tree and checkout submodule: avoid auto-discovery in new working tree manipulator code submodule_move_head: reuse child_process structure for futher commands
This commit is contained in:
commit
146b0ab1a5
21
submodule.c
21
submodule.c
@ -1363,7 +1363,7 @@ static int submodule_has_dirty_index(const struct submodule *sub)
|
|||||||
{
|
{
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
|
|
||||||
prepare_submodule_repo_env_no_git_dir(&cp.env_array);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
|
|
||||||
cp.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
argv_array_pushl(&cp.args, "diff-index", "--quiet",
|
argv_array_pushl(&cp.args, "diff-index", "--quiet",
|
||||||
@ -1380,7 +1380,7 @@ static int submodule_has_dirty_index(const struct submodule *sub)
|
|||||||
static void submodule_reset_index(const char *path)
|
static void submodule_reset_index(const char *path)
|
||||||
{
|
{
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
prepare_submodule_repo_env_no_git_dir(&cp.env_array);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
|
|
||||||
cp.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
cp.no_stdin = 1;
|
cp.no_stdin = 1;
|
||||||
@ -1438,7 +1438,7 @@ int submodule_move_head(const char *path,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_submodule_repo_env_no_git_dir(&cp.env_array);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
|
|
||||||
cp.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
cp.no_stdin = 1;
|
cp.no_stdin = 1;
|
||||||
@ -1446,7 +1446,7 @@ int submodule_move_head(const char *path,
|
|||||||
|
|
||||||
argv_array_pushf(&cp.args, "--super-prefix=%s%s/",
|
argv_array_pushf(&cp.args, "--super-prefix=%s%s/",
|
||||||
get_super_prefix_or_empty(), path);
|
get_super_prefix_or_empty(), path);
|
||||||
argv_array_pushl(&cp.args, "read-tree", NULL);
|
argv_array_pushl(&cp.args, "read-tree", "--recurse-submodules", NULL);
|
||||||
|
|
||||||
if (flags & SUBMODULE_MOVE_HEAD_DRY_RUN)
|
if (flags & SUBMODULE_MOVE_HEAD_DRY_RUN)
|
||||||
argv_array_push(&cp.args, "-n");
|
argv_array_push(&cp.args, "-n");
|
||||||
@ -1468,15 +1468,16 @@ int submodule_move_head(const char *path,
|
|||||||
|
|
||||||
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
|
if (!(flags & SUBMODULE_MOVE_HEAD_DRY_RUN)) {
|
||||||
if (new) {
|
if (new) {
|
||||||
struct child_process cp1 = CHILD_PROCESS_INIT;
|
child_process_init(&cp);
|
||||||
/* also set the HEAD accordingly */
|
/* also set the HEAD accordingly */
|
||||||
cp1.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
cp1.no_stdin = 1;
|
cp.no_stdin = 1;
|
||||||
cp1.dir = path;
|
cp.dir = path;
|
||||||
|
|
||||||
argv_array_pushl(&cp1.args, "update-ref", "HEAD", new, NULL);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
|
argv_array_pushl(&cp.args, "update-ref", "HEAD", new, NULL);
|
||||||
|
|
||||||
if (run_command(&cp1)) {
|
if (run_command(&cp)) {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -787,11 +787,6 @@ test_submodule_switch_recursing () {
|
|||||||
then
|
then
|
||||||
RESULTDS=failure
|
RESULTDS=failure
|
||||||
fi
|
fi
|
||||||
RESULTR=success
|
|
||||||
if test "$KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED" = 1
|
|
||||||
then
|
|
||||||
RESULTR=failure
|
|
||||||
fi
|
|
||||||
RESULTOI=success
|
RESULTOI=success
|
||||||
if test "$KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED" = 1
|
if test "$KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED" = 1
|
||||||
then
|
then
|
||||||
@ -1003,7 +998,7 @@ test_submodule_switch_recursing () {
|
|||||||
'
|
'
|
||||||
|
|
||||||
# recursing deeper than one level doesn't work yet.
|
# recursing deeper than one level doesn't work yet.
|
||||||
test_expect_$RESULTR "$command: modified submodule updates submodule recursively" '
|
test_expect_success "$command: modified submodule updates submodule recursively" '
|
||||||
prolog &&
|
prolog &&
|
||||||
reset_work_tree_to_interested add_nested_sub &&
|
reset_work_tree_to_interested add_nested_sub &&
|
||||||
(
|
(
|
||||||
|
@ -5,7 +5,6 @@ test_description='read-tree can handle submodules'
|
|||||||
. ./test-lib.sh
|
. ./test-lib.sh
|
||||||
. "$TEST_DIRECTORY"/lib-submodule-update.sh
|
. "$TEST_DIRECTORY"/lib-submodule-update.sh
|
||||||
|
|
||||||
KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED=1
|
|
||||||
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
||||||
KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED=1
|
KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED=1
|
||||||
|
|
||||||
|
@ -64,7 +64,6 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/
|
|||||||
'
|
'
|
||||||
|
|
||||||
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
||||||
KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED=1
|
|
||||||
test_submodule_switch_recursing "git checkout --recurse-submodules"
|
test_submodule_switch_recursing "git checkout --recurse-submodules"
|
||||||
|
|
||||||
test_submodule_forced_switch_recursing "git checkout -f --recurse-submodules"
|
test_submodule_forced_switch_recursing "git checkout -f --recurse-submodules"
|
||||||
|
Loading…
Reference in New Issue
Block a user