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

Re: [PATCH v3 0/4] Standardize early option scanning

From
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Date
Oct 30, 2026, 21:33 UTC
Message-ID
<1e194ea7-2e28-4142-b678-d8cb8bca8e35@gmail.com>
In-Reply-To
<20261012074413.337183-1-christian.couder@gmail.com>
On 10/12/26 13:14, Christian Couder wrote:
Show 30 quoted lines
> > Changes since v2
> ================
> > Thanks a lot to Junio and Kaartic who reviewed previous versions.
> > Rebased on top of a018953688 (Git 2.56, 2026-09-27) to start from a
> stable base.
> > There are a number of important changes since v2:
> >   - In patch 1/4, parse_options_takes_argument() now considers
>     PARSE_OPT_LASTARG_DEFAULT options as taking a value. This allows us
>     to remove a limitation that was in v2 as these options now consume
>     the next argument when there is one, like in parse_options().
> >   - Patch 2/4 is new, see above.
> >   - In patch 3/4, we reuse the new lookup_long_opt() function extracted
>     by patch 2/4. This removes a number of limitations (around negated
>     forms, unambiguous abbreviations and aliases) that were in v2, as
>     the early scan now behaves in a similar way as parse_options()
>     regarding long options. A number of tests have been added to ensure
>     that.
> >   - In patch 3/4, the scan now stops at short options, unknown options,
>     ambiguous or disallowed abbreviations, options with a low-level
>     callback, and value-taking options given as the last argument,
>     instead of skipping over them, as it could otherwise take an
>     option's value for an option.
> >   - In patch 3/4, early_scan_fn() has a new `unset` argument for
>     negated options, and early_scan_options() now returns the index of
>     the first argument not consumed also when the callback stops the
>     scan.
> >   - In patch 4/4, the commit message and documentation are updated to
>     account for the better behavior of the early scan. A related
>     NEEDSWORK comment is also removed, and some tests added.
>
The v3 seems to be in a much better state to me. Just left a few minor comments.
Thank you for working on this!
-- 
Sivaraam
Previous: Christian CouderNext: Christian Couder
Message 34 of 41 in “Standardize early option scanning to fix argument parsing bugs”
  1. 0/6 Standardize early option scanning to fix argument parsing bugsChristian Couder, Sep 2, 2026
  2. 1/6 parse-options: add early_scan_options()Christian Couder, Sep 2, 2026
  3. Junio C HamanoSep 2, 2026
  4. Christian CouderSep 23, 2026
  5. Junio C HamanoSep 23, 2026
  6. 2/6 bisect: fix "--" detection when a term name is "--"Christian Couder, Sep 2, 2026
  7. Junio C HamanoSep 2, 2026
  8. Christian CouderSep 23, 2026
  9. Junio C HamanoSep 23, 2026
  10. 3/6 rev-parse: fix "--" detection when it is an option valueChristian Couder, Sep 2, 2026
  11. 4/6 parse-options: add parse_options_takes_argument()Christian Couder, Sep 2, 2026
  12. 5/6 parse-options: build early scan options from a struct option arrayChristian Couder, Sep 2, 2026
  13. 6/6 fast-import: use early_scan_options() for --allow-unsafe-featuresChristian Couder, Sep 2, 2026
  14. Junio C HamanoSep 4, 2026
  15. Junio C HamanoSep 2, 2026
  16. Christian CouderSep 23, 2026
  17. 0/3 Standardize early option scanningChristian Couder, Sep 23, 2026
  18. 1/3 parse-options: add parse_options_takes_argument()Christian Couder, Sep 23, 2026
  19. 2/3 parse-options: add early_scan_options()Christian Couder, Sep 23, 2026
  20. Kaartic SivaraamSep 30, 2026
  21. Christian CouderOct 12, 2026
  22. 3/3 fast-import: use early_scan_options() for --allow-unsafe-featuresChristian Couder, Sep 23, 2026
  23. 0/4 Standardize early option scanningChristian Couder, Oct 12, 2026
  24. 1/4 parse-options: add parse_options_takes_argument()Christian Couder, Oct 12, 2026
  25. 2/4 parse-options: extract lookup_long_opt() from parse_long_opt()Christian Couder, Oct 12, 2026
  26. Kaartic SivaraamOct 30, 2026
  27. Christian CouderNov 2, 2026
  28. 3/4 parse-options: add early_scan_options()Christian Couder, Oct 12, 2026
  29. Kaartic SivaraamOct 30, 2026
  30. Christian CouderNov 2, 2026
  31. 4/4 fast-import: use early_scan_options() for --allow-unsafe-featuresChristian Couder, Oct 12, 2026
  32. Cynthia UcheOct 31, 2026
  33. Christian CouderNov 2, 2026
  34. Kaartic SivaraamOct 30, 2026
  35. 0/4 Standardize early option scanningChristian Couder, Nov 2, 2026
  36. 1/4 parse-options: add parse_options_takes_argument()Christian Couder, Nov 2, 2026
  37. 2/4 parse-options: extract lookup_long_opt() from parse_long_opt()Christian Couder, Nov 2, 2026
  38. 3/4 parse-options: add early_scan_options()Christian Couder, Nov 2, 2026
  39. 4/4 fast-import: use early_scan_options() for --allow-unsafe-featuresChristian Couder, Nov 2, 2026
  40. Kaartic SivaraamNov 3, 2026
  41. Junio C HamanoNov 3, 2026

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.