mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
submodule test invocation: only pass additional arguments
In a later patch we want to introduce a config option to trigger the submodule recursing by default. As this option should be available and uniform across all commands that deal with submodules we'd want to test for this option in the submodule update library. So instead of calling the whole test set again for "git -c submodule.recurse foo" instead of "git foo --recurse-submodules", we'd only want to introduce one basic test that tests if the option is recognized and respected to not overload the test suite. Change the test functions by taking only the argument and assemble the command inside the test function by embedding the arguments into the command that is "git $arguments --recurse-submodules". It would be nice to do this for all functions in lib-submodule-update, but we cannot do that for the non-recursing tests, as there we do not just pass in a git command but whole functions. (See t3426 for example) Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
58b75bd6db
commit
17f38cb704
@ -781,8 +781,9 @@ test_submodule_forced_switch () {
|
||||
# - Removing a submodule with a git directory absorbs the submodules
|
||||
# git directory first into the superproject.
|
||||
|
||||
test_submodule_switch_recursing () {
|
||||
command="$1"
|
||||
test_submodule_switch_recursing_with_args () {
|
||||
cmd_args="$1"
|
||||
command="git $cmd_args --recurse-submodules"
|
||||
RESULTDS=success
|
||||
if test "$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS" = 1
|
||||
then
|
||||
@ -1021,8 +1022,9 @@ test_submodule_switch_recursing () {
|
||||
# Test that submodule contents are updated when switching between commits
|
||||
# that change a submodule, but throwing away local changes in
|
||||
# the superproject as well as the submodule is allowed.
|
||||
test_submodule_forced_switch_recursing () {
|
||||
command="$1"
|
||||
test_submodule_forced_switch_recursing_with_args () {
|
||||
cmd_args="$1"
|
||||
command="git $cmd_args --recurse-submodules"
|
||||
RESULT=success
|
||||
if test "$KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS" = 1
|
||||
then
|
||||
|
@ -9,9 +9,9 @@ KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED=1
|
||||
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
||||
KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED=1
|
||||
|
||||
test_submodule_switch_recursing "git read-tree --recurse-submodules -u -m"
|
||||
test_submodule_switch_recursing_with_args "read-tree -u -m"
|
||||
|
||||
test_submodule_forced_switch_recursing "git read-tree --recurse-submodules -u --reset"
|
||||
test_submodule_forced_switch_recursing_with_args "read-tree -u --reset"
|
||||
|
||||
test_submodule_switch "git read-tree -u -m"
|
||||
|
||||
|
@ -65,9 +65,9 @@ test_expect_success '"checkout <submodule>" honors submodule.*.ignore from .git/
|
||||
|
||||
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
||||
KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED=1
|
||||
test_submodule_switch_recursing "git checkout --recurse-submodules"
|
||||
test_submodule_switch_recursing_with_args "checkout"
|
||||
|
||||
test_submodule_forced_switch_recursing "git checkout -f --recurse-submodules"
|
||||
test_submodule_forced_switch_recursing_with_args "checkout -f"
|
||||
|
||||
test_submodule_switch "git checkout"
|
||||
|
||||
|
@ -9,9 +9,9 @@ KNOWN_FAILURE_SUBMODULE_RECURSIVE_NESTED=1
|
||||
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
|
||||
KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED=1
|
||||
|
||||
test_submodule_switch_recursing "git reset --recurse-submodules --keep"
|
||||
test_submodule_switch_recursing_with_args "reset --keep"
|
||||
|
||||
test_submodule_forced_switch_recursing "git reset --hard --recurse-submodules"
|
||||
test_submodule_forced_switch_recursing_with_args "reset --hard"
|
||||
|
||||
test_submodule_switch "git reset --keep"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user