Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2020-06-11 20:41:49 +0300
committerJunio C Hamano <gitster@pobox.com>2020-06-12 21:33:40 +0300
commitaa06180ac90984204e59ac74bb4e3a4d09037ac2 (patch)
treed2754694324423c5904f60990d702826b3721ff0 /t/lib-submodule-update.sh
parentadd245234820be6cec3f54174d44f738aa1a80f9 (diff)
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>
Diffstat (limited to 't/lib-submodule-update.sh')
-rwxr-xr-xt/lib-submodule-update.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index bb36287803..7c3ba1be00 100755
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -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.