From: "Patrik Weiskircher via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: apenwarr@gmail.com, Junio C Hamano <gitster@pobox.com>,
"D. Ben Knoble" <ben.knoble@gmail.com>,
Patrik Weiskircher <patrik.weiskircher@nutrient.io>,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Patrik Weiskircher <patrik@pspdfkit.com>,
Patrik Weiskircher <patrik@pspdfkit.com>
Subject: [PATCH v2 1/2] contrib/subtree: parse using --stuck-long
Date: Wed, 04 Jun 2025 14:16:36 +0000 [thread overview]
Message-ID: <5bbdbf01636058b945ec7f40df6f2a8cb4cdc966.1749046597.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1928.v2.git.1749046597.gitgitgadget@gmail.com>
From: Patrik Weiskircher <patrik@pspdfkit.com>
Optional parameter handling only works unambiguous with git rev-parse
--parseopt when using the --stuck-long option. To prepare for future commits
which add flags with optional parameters, parse with --stuck-long.
Signed-off-by: Patrik Weiskircher <patrik@pspdfkit.com>
---
contrib/subtree/git-subtree.sh | 34 +++++++++++++---------------------
1 file changed, 13 insertions(+), 21 deletions(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 15ae86db1b27..60b2431b8bba 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -115,7 +115,7 @@ main () {
then
set -- -h
fi
- set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt -- "$@" || echo exit $?)"
+ set_args="$(echo "$OPTS_SPEC" | git rev-parse --parseopt --stuck-long -- "$@" || echo exit $?)"
eval "$set_args"
. git-sh-setup
require_work_tree
@@ -131,9 +131,6 @@ main () {
opt="$1"
shift
case "$opt" in
- --annotate|-b|-P|-m|--onto)
- shift
- ;;
--rejoin)
arg_split_rejoin=1
;;
@@ -177,42 +174,37 @@ main () {
shift
case "$opt" in
- -q)
+ --quiet)
arg_quiet=1
;;
- -d)
+ --debug)
arg_debug=1
;;
- --annotate)
+ --annotate=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_annotate="$1"
- shift
+ arg_split_annotate="${opt#*=}"
;;
--no-annotate)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
arg_split_annotate=
;;
- -b)
+ --branch=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_branch="$1"
- shift
+ arg_split_branch="${opt#*=}"
;;
- -P)
- arg_prefix="${1%/}"
- shift
+ --prefix=*)
+ arg_prefix="${opt#*=}"
;;
- -m)
+ --message=*)
test -n "$allow_addmerge" || die_incompatible_opt "$opt" "$arg_command"
- arg_addmerge_message="$1"
- shift
+ arg_addmerge_message="${opt#*=}"
;;
--no-prefix)
arg_prefix=
;;
- --onto)
+ --onto=*)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
- arg_split_onto="$1"
- shift
+ arg_split_onto="${opt#*=}"
;;
--no-onto)
test -n "$allow_split" || die_incompatible_opt "$opt" "$arg_command"
--
gitgitgadget
next prev parent reply other threads:[~2025-06-04 14:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 16:40 [PATCH 0/2] contrib/subtree: Add -S/-gpg-sign Patrik Weiskircher via GitGitGadget
2025-06-02 16:40 ` [PATCH 1/2] contrib/subtree: parse using --stuck-long Patrik Weiskircher via GitGitGadget
2025-06-03 20:42 ` D. Ben Knoble
2025-06-04 13:56 ` Patrik Weiskircher
2025-06-04 14:09 ` Kristoffer Haugsbakk
2025-06-04 15:41 ` Junio C Hamano
2025-06-04 15:43 ` Patrik Weiskircher
2025-06-02 16:40 ` [PATCH 2/2] contrib/subtree: add -S/--gpg-sign Patrik Weiskircher via GitGitGadget
2025-06-04 14:16 ` [PATCH v2 0/2] contrib/subtree: Add -S/-gpg-sign Patrik Weiskircher via GitGitGadget
2025-06-04 14:16 ` Patrik Weiskircher via GitGitGadget [this message]
2025-06-04 14:16 ` [PATCH v2 2/2] contrib/subtree: add -S/--gpg-sign Patrik Weiskircher via GitGitGadget
2025-06-04 16:33 ` [PATCH v2 0/2] contrib/subtree: Add -S/-gpg-sign Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5bbdbf01636058b945ec7f40df6f2a8cb4cdc966.1749046597.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=apenwarr@gmail.com \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=patrik.weiskircher@nutrient.io \
--cc=patrik@pspdfkit.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).