git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] contrib/subtree: parse using --stuck-long

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Jun 3, 2025, 20:42 UTC
Message-ID
<CALnO6CDk4cP1Mef07F6Z8Sm-1MxwWWd-rYEfL-e5_Nnq50B4ng@mail.gmail.com>
In-Reply-To
<fe7e918ba1831fffead46791441da350223998f7.1748882439.git.gitgitgadget@gmail.com>

On Mon, Jun 2, 2025 at 12:41 PM Patrik Weiskircher via GitGitGadget <gitgitgadget@gmail.com> wrote:

Show 6 quoted lines
>
> From: Patrik Weiskircher <patrik@pspdfkit.com>
>
> -S/--gpg-sign requires an optional parameter. Optional parameter
> handling only works unambiguous with git rev-parse --parseopt when using
> the --stuck-long option.
Here we mention "-S", but that flag isn't implemented yet, right?
Perhaps something like:
    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.
Show 88 quoted lines
>
> 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
>
>
-- 
D. Ben Knoble
Previous: Patrik Weiskircher via GitGitGadgetNext: Patrik Weiskircher
Message 3 of 12 in “contrib/subtree: Add -S/-gpg-sign”
  1. 0/2 contrib/subtree: Add -S/-gpg-signPatrik Weiskircher via GitGitGadget, Jun 2, 2025
  2. 1/2 contrib/subtree: parse using --stuck-longPatrik Weiskircher via GitGitGadget, Jun 2, 2025
  3. D. Ben KnobleJun 3, 2025
  4. Patrik WeiskircherJun 4, 2025
  5. Kristoffer HaugsbakkJun 4, 2025
  6. Junio C HamanoJun 4, 2025
  7. Patrik WeiskircherJun 4, 2025
  8. 2/2 contrib/subtree: add -S/--gpg-signPatrik Weiskircher via GitGitGadget, Jun 2, 2025
  9. 0/2 contrib/subtree: Add -S/-gpg-signPatrik Weiskircher via GitGitGadget, Jun 4, 2025
  10. 1/2 contrib/subtree: parse using --stuck-longPatrik Weiskircher via GitGitGadget, Jun 4, 2025
  11. 2/2 contrib/subtree: add -S/--gpg-signPatrik Weiskircher via GitGitGadget, Jun 4, 2025
  12. Junio C HamanoJun 4, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.