diff mbox series

[01/10] git-submodule.sh: create a "case" dispatch statement

Message ID patch-01.10-2379d5dc0e0-20221017T115544Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series submodule: make it a built-in, remove git-submodule.sh | expand

Commit Message

Ævar Arnfjörð Bjarmason Oct. 17, 2022, 12:09 p.m. UTC
Create a "case/esac" dispatch statement at the end of git-submodule.sh
and move the contents of the trivial cmd_absorbgitdirs() function to
it.

This template will be expanded on in subsequent commits, but for now
we're moving the trivial "git submodule absorb-git-dirs" to it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 git-submodule.sh | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/git-submodule.sh b/git-submodule.sh
index 5e5d21c010f..b851d64aa62 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -555,11 +555,6 @@  cmd_sync()
 	git ${wt_prefix:+-C "$wt_prefix"} submodule--helper sync ${quiet:+--quiet} ${recursive:+--recursive} -- "$@"
 }
 
-cmd_absorbgitdirs()
-{
-	git submodule--helper absorbgitdirs --prefix "$wt_prefix" "$@"
-}
-
 # This loop parses the command line arguments to find the
 # subcommand name to dispatch.  Parsing of the subcommand specific
 # options are primarily done by the subcommand implementations.
@@ -608,4 +603,11 @@  then
 	usage
 fi
 
-"cmd_$(echo $command | sed -e s/-/_/g)" "$@"
+case "$command" in
+absorbgitdirs)
+	git submodule--helper "$command" --prefix "$wt_prefix" "$@"
+	;;
+*)
+	"cmd_$(echo $command | sed -e s/-/_/g)" "$@"
+	;;
+esac