[PATCH 2/8] submodule update: pass options containing "[no-]"
- From
Glen Choo via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Jun 10, 2022, 00:26 UTC
- Message-ID
- <058d84864120844e70f3a2dc65432d6327d63bea.1654820781.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1275.git.git.1654820781.gitgitgadget@gmail.com>
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 --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 \
-- gitgitgadget