Skip to content

Commit 1f46176

Browse files
committed
Use --stuck-long when parsing arguments
This is in preparation of adding a parameter -S with an optional argument.
1 parent 7014b55 commit 1f46176

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ main () {
115115
then
116116
set -- -h
117117
fi
118-
set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
118+
set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt --stuck-long -- "$@" || echo exit $?)"
119119
eval "$set_args"
120120
. git-sh-setup
121121
require_work_tree
@@ -131,9 +131,6 @@ main () {
131131
opt="$1"
132132
shift
133133
case "$opt" in
134-
--annotate|-b|-P|-m|--onto)
135-
shift
136-
;;
137134
--rejoin)
138135
arg_split_rejoin=1
139136
;;
@@ -177,42 +174,37 @@ main () {
177174
shift
178175

179176
case "$opt" in
180-
-q)
177+
--quiet)
181178
arg_quiet=1
182179
;;
183-
-d)
180+
--debug)
184181
arg_debug=1
185182
;;
186-
--annotate)
183+
--annotate=*)
187184
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
188-
arg_split_annotate="$1"
189-
shift
185+
arg_split_annotate="${opt#*=}"
190186
;;
191187
--no-annotate)
192188
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
193189
arg_split_annotate=
194190
;;
195-
-b)
191+
--branch=*)
196192
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
197-
arg_split_branch="$1"
198-
shift
193+
arg_split_branch="${opt#*=}"
199194
;;
200-
-P)
201-
arg_prefix="${1%/}"
202-
shift
195+
--prefix=*)
196+
arg_prefix="${opt#*=}"
203197
;;
204-
-m)
198+
--message=*)
205199
test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
206-
arg_addmerge_message="$1"
207-
shift
200+
arg_addmerge_message="${opt#*=}"
208201
;;
209202
--no-prefix)
210203
arg_prefix=
211204
;;
212-
--onto)
205+
--onto=*)
213206
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
214-
arg_split_onto="$1"
215-
shift
207+
arg_split_onto="${opt#*=}"
216208
;;
217209
--no-onto)
218210
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"

0 commit comments

Comments
 (0)