lib-submodule-update: prepend "git" to $command
Since all invocations of test_submodule_forced_switch() are git commands, automatically prepend "git" before invoking test_submodule_switch_common(). Similarly, many invocations of test_submodule_switch() are also git commands so automatically prepend "git" before invoking test_submodule_switch_common() as well. Finally, for invocations of test_submodule_switch() that invoke a custom function, rename the old function to test_submodule_switch_func(). This is necessary because in a future commit, we will be adding some logic that needs to distinguish between an invocation of a plain git comamnd and an invocation of a test helper function. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
add2452348
commit
aa06180ac9
@ -307,8 +307,8 @@ test_submodule_content () {
|
||||
# to protect the history!
|
||||
#
|
||||
|
||||
# Internal function; use test_submodule_switch() or
|
||||
# test_submodule_forced_switch() instead.
|
||||
# Internal function; use test_submodule_switch_func(), test_submodule_switch(),
|
||||
# or test_submodule_forced_switch() instead.
|
||||
test_submodule_switch_common () {
|
||||
command="$1"
|
||||
######################### Appearing submodule #########################
|
||||
@ -566,8 +566,8 @@ test_submodule_switch_common () {
|
||||
# # Do something here that updates the worktree and index to match target,
|
||||
# # but not any submodule directories.
|
||||
# }
|
||||
# test_submodule_switch "my_func"
|
||||
test_submodule_switch () {
|
||||
# test_submodule_switch_func "my_func"
|
||||
test_submodule_switch_func () {
|
||||
command="$1"
|
||||
test_submodule_switch_common "$command"
|
||||
|
||||
@ -587,12 +587,16 @@ test_submodule_switch () {
|
||||
'
|
||||
}
|
||||
|
||||
test_submodule_switch () {
|
||||
test_submodule_switch_func "git $1"
|
||||
}
|
||||
|
||||
# Same as test_submodule_switch(), except that throwing away local changes in
|
||||
# the superproject is allowed.
|
||||
test_submodule_forced_switch () {
|
||||
command="$1"
|
||||
KNOWN_FAILURE_FORCED_SWITCH_TESTS=1
|
||||
test_submodule_switch_common "$command"
|
||||
test_submodule_switch_common "git $command"
|
||||
|
||||
# When forced, a file in the superproject does not prevent creating a
|
||||
# submodule of the same name.
|
||||
|
Reference in New Issue
Block a user