diff mbox series

[2/8] submodule update: pass options containing "[no-]"

Message ID 058d84864120844e70f3a2dc65432d6327d63bea.1654820781.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series submodule update: parse all options in C | expand

Commit Message

Glen Choo June 10, 2022, 12:26 a.m. UTC
From: Glen Choo <chooglen@google.com>

"git submodule--helper update" understands these options, so append them
to `opts` and remove their intermediate variables.

As a result, we now pass every instance of the option and its "no-"
variant to "git submodule--helper update" instead of only passing the
last instance. As we noted in the previous commit, this is good because
this makes our options parsing consistent.

Signed-off-by: Glen Choo <chooglen@google.com>
---
 git-submodule.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/git-submodule.sh b/git-submodule.sh
index f4679e0db80..8c46eac22e8 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -296,10 +296,10 @@  cmd_update()
 			update="checkout"
 			;;
 		--recommend-shallow)
-			recommend_shallow="--recommend-shallow"
+			opts="$opts $1"
 			;;
 		--no-recommend-shallow)
-			recommend_shallow="--no-recommend-shallow"
+			opts="$opts $1"
 			;;
 		--depth)
 			case "$2" in '') usage ;; esac
@@ -318,10 +318,10 @@  cmd_update()
 			jobs=$1
 			;;
 		--single-branch)
-			single_branch="--single-branch"
+			opts="$opts $1"
 			;;
 		--no-single-branch)
-			single_branch="--no-single-branch"
+			opts="$opts $1"
 			;;
 		--filter)
 			case "$2" in '') usage ;; esac
@@ -354,8 +354,6 @@  cmd_update()
 		${reference:+"$reference"} \
 		${depth:+"$depth"} \
 		${require_init:+--require-init} \
-		$single_branch \
-		$recommend_shallow \
 		$jobs \
 		$filter \
 		$opts \