git-submodule.sh: improve parsing of some long options
Some command-line options have a long form which takes an argument. In this case, the argument can be given right after `='; for example, "--depth" takes a numerical argument, which can be given as "--depth=X". Support the case where the argument is given right after `=' for all long options, in order to improve consistency throughout the script. Signed-off-by: Roy Eldar <royeldar0@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Roy Eldar committed
Dec 11, 2024 at 08:32 UTC
b71687ca03fe5909eae54cd6f2e044822ca335de
1 file changed
+9
git-submodule.sh
+9
@@ -77,6 +77,9 @@ cmd_add()
77
branch=$2
78
shift
79
;;
80
+ --branch=*)
81
+ branch="${1#--branch=}"
82
+ ;;
83
-f | --force)
84
force=$1
85
;;
@@ -110,6 +113,9 @@ cmd_add()
113
custom_name=$2
114
shift
115
;;
116
+ --name=*)
117
+ custom_name="${1#--name=}"
118
+ ;;
119
--depth)
120
case "$2" in '') usage ;; esac
121
depth="--depth=$2"
@@ -425,6 +431,9 @@ cmd_set_branch() {
431
branch=$2
432
shift
433
;;
434
+ --branch=*)
435
+ branch="${1#--branch=}"
436
+ ;;
437
--)
438
shift
439
break