diff mbox series

[2/4] lib-submodule-update: consolidate --recurse-submodules

Message ID d5809877af3e20eb9ff459a91d3099846fd32197.1588162842.git.liu.denton@gmail.com (mailing list archive)
State New, archived
Headers show
Series t: replace incorrect test_must_fail usage (part 5) | expand

Commit Message

Denton Liu April 29, 2020, 12:22 p.m. UTC
Both test_submodule_switch_recursing_with_args() and
test_submodule_forced_switch_recursing_with_args() call the internal
function test_submodule_recursing_with_args_common() with the final
argument of `--recurse-submodules`. Consolidate this duplication by
appending the argument in test_submodule_recursing_with_args_common().

Signed-off-by: Denton Liu <liu.denton@gmail.com>
---
 t/lib-submodule-update.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Junio C Hamano April 29, 2020, 6:06 p.m. UTC | #1
Denton Liu <liu.denton@gmail.com> writes:

> Both test_submodule_switch_recursing_with_args() and
> test_submodule_forced_switch_recursing_with_args() call the internal
> function test_submodule_recursing_with_args_common() with the final
> argument of `--recurse-submodules`. Consolidate this duplication by
> appending the argument in test_submodule_recursing_with_args_common().
>

OK, I just made sure that these two are the only callers and they
both pass the "--recurse-submodules", so the patch looks quite
sensible.

Thanks.

> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>  t/lib-submodule-update.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
> index a3732d3f6c..81457b4c31 100644
> --- a/t/lib-submodule-update.sh
> +++ b/t/lib-submodule-update.sh
> @@ -632,7 +632,7 @@ test_submodule_forced_switch () {
>  # Internal function; use test_submodule_switch_recursing_with_args() or
>  # test_submodule_forced_switch_recursing_with_args() instead.
>  test_submodule_recursing_with_args_common () {
> -	command="$1"
> +	command="$1 --recurse-submodules"
>  
>  	######################### Appearing submodule #########################
>  	# Switching to a commit letting a submodule appear checks it out ...
> @@ -840,7 +840,7 @@ test_submodule_recursing_with_args_common () {
>  # test_submodule_switch_recursing_with_args "$GIT_COMMAND"
>  test_submodule_switch_recursing_with_args () {
>  	cmd_args="$1"
> -	command="git $cmd_args --recurse-submodules"
> +	command="git $cmd_args"
>  	test_submodule_recursing_with_args_common "$command"
>  
>  	RESULTDS=success
> @@ -957,7 +957,7 @@ test_submodule_switch_recursing_with_args () {
>  # away local changes in the superproject is allowed.
>  test_submodule_forced_switch_recursing_with_args () {
>  	cmd_args="$1"
> -	command="git $cmd_args --recurse-submodules"
> +	command="git $cmd_args"
>  	test_submodule_recursing_with_args_common "$command"
>  
>  	RESULT=success
diff mbox series

Patch

diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh
index a3732d3f6c..81457b4c31 100644
--- a/t/lib-submodule-update.sh
+++ b/t/lib-submodule-update.sh
@@ -632,7 +632,7 @@  test_submodule_forced_switch () {
 # Internal function; use test_submodule_switch_recursing_with_args() or
 # test_submodule_forced_switch_recursing_with_args() instead.
 test_submodule_recursing_with_args_common () {
-	command="$1"
+	command="$1 --recurse-submodules"
 
 	######################### Appearing submodule #########################
 	# Switching to a commit letting a submodule appear checks it out ...
@@ -840,7 +840,7 @@  test_submodule_recursing_with_args_common () {
 # test_submodule_switch_recursing_with_args "$GIT_COMMAND"
 test_submodule_switch_recursing_with_args () {
 	cmd_args="$1"
-	command="git $cmd_args --recurse-submodules"
+	command="git $cmd_args"
 	test_submodule_recursing_with_args_common "$command"
 
 	RESULTDS=success
@@ -957,7 +957,7 @@  test_submodule_switch_recursing_with_args () {
 # away local changes in the superproject is allowed.
 test_submodule_forced_switch_recursing_with_args () {
 	cmd_args="$1"
-	command="git $cmd_args --recurse-submodules"
+	command="git $cmd_args"
 	test_submodule_recursing_with_args_common "$command"
 
 	RESULT=success