t/lib-submodule-update: move a test to the right section
The test "$command: submodule branch is not changed, detach HEAD instead" is in the "Appearing submodule" section of test_submodule_recursing_with_args_common(), but this test updates a submodule; it does not test a transition from a state with no submodule to a state with a submodule. As such, for consistency, move it to the "Modified submodule" section of the same function. While at it, add a comment describing the test. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d5779b61d8
commit
8d48dd1988
@ -658,22 +658,6 @@ test_submodule_recursing_with_args_common() {
|
|||||||
test_submodule_content sub1 origin/add_sub1
|
test_submodule_content sub1 origin/add_sub1
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
test_expect_success "$command: submodule branch is not changed, detach HEAD instead" '
|
|
||||||
prolog &&
|
|
||||||
reset_work_tree_to_interested add_sub1 &&
|
|
||||||
(
|
|
||||||
cd submodule_update &&
|
|
||||||
git -C sub1 checkout -b keep_branch &&
|
|
||||||
git -C sub1 rev-parse HEAD >expect &&
|
|
||||||
git branch -t modify_sub1 origin/modify_sub1 &&
|
|
||||||
$command modify_sub1 &&
|
|
||||||
test_superproject_content origin/modify_sub1 &&
|
|
||||||
test_submodule_content sub1 origin/modify_sub1 &&
|
|
||||||
git -C sub1 rev-parse keep_branch >actual &&
|
|
||||||
test_cmp expect actual &&
|
|
||||||
test_must_fail git -C sub1 symbolic-ref HEAD
|
|
||||||
)
|
|
||||||
'
|
|
||||||
|
|
||||||
# Replacing a tracked file with a submodule produces a checked out submodule
|
# Replacing a tracked file with a submodule produces a checked out submodule
|
||||||
test_expect_success "$command: replace tracked file with submodule checks out submodule" '
|
test_expect_success "$command: replace tracked file with submodule checks out submodule" '
|
||||||
@ -789,6 +773,23 @@ test_submodule_recursing_with_args_common() {
|
|||||||
test_submodule_content sub1 origin/add_sub1
|
test_submodule_content sub1 origin/add_sub1
|
||||||
)
|
)
|
||||||
'
|
'
|
||||||
|
# Updating a submodule does not touch the currently checked out branch in the submodule
|
||||||
|
test_expect_success "$command: submodule branch is not changed, detach HEAD instead" '
|
||||||
|
prolog &&
|
||||||
|
reset_work_tree_to_interested add_sub1 &&
|
||||||
|
(
|
||||||
|
cd submodule_update &&
|
||||||
|
git -C sub1 checkout -b keep_branch &&
|
||||||
|
git -C sub1 rev-parse HEAD >expect &&
|
||||||
|
git branch -t modify_sub1 origin/modify_sub1 &&
|
||||||
|
$command modify_sub1 &&
|
||||||
|
test_superproject_content origin/modify_sub1 &&
|
||||||
|
test_submodule_content sub1 origin/modify_sub1 &&
|
||||||
|
git -C sub1 rev-parse keep_branch >actual &&
|
||||||
|
test_cmp expect actual &&
|
||||||
|
test_must_fail git -C sub1 symbolic-ref HEAD
|
||||||
|
)
|
||||||
|
'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Declares and invokes several tests that, in various situations, checks that
|
# Declares and invokes several tests that, in various situations, checks that
|
||||||
|
Reference in New Issue
Block a user