submodule--helper: understand --checkout, --merge and --rebase synonyms

Understand --checkout, --merge and --rebase synonyms for
--update={checkout,merge,rebase}, as well as the short options that
'git submodule' itself understands.

This removes a difference between the CLI API of "git submodule" and
"git submodule--helper", making it easier to make the latter an alias
for the former. See 48308681b0 (git submodule update: have a
dedicated helper for cloning, 2016-02-29) for the initial addition of
--update.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason
2022-06-28 12:05:31 +02:00
committed by Junio C Hamano
parent 36d45163b6
commit 8f12108c29
2 changed files with 39 additions and 5 deletions

View File

@@ -40,7 +40,9 @@ require_init=
files=
remote=
nofetch=
update=
rebase=
merge=
checkout=
custom_name=
depth=
progress=
@@ -260,7 +262,7 @@ cmd_update()
force=$1
;;
-r|--rebase)
update="rebase"
rebase=1
;;
--reference)
case "$2" in '') usage ;; esac
@@ -274,13 +276,13 @@ cmd_update()
dissociate=1
;;
-m|--merge)
update="merge"
merge=1
;;
--recursive)
recursive=1
;;
--checkout)
update="checkout"
checkout=1
;;
--recommend-shallow)
recommend_shallow="--recommend-shallow"
@@ -341,7 +343,9 @@ cmd_update()
${init:+--init} \
${nofetch:+--no-fetch} \
${wt_prefix:+--prefix "$wt_prefix"} \
${update:+--update "$update"} \
${rebase:+--rebase} \
${merge:+--merge} \
${checkout:+--checkout} \
${reference:+"$reference"} \
${dissociate:+"--dissociate"} \
${depth:+"$depth"} \