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

- From: Kaartic Sivaraam \<hidden\>
- Date: 2026-10-30 21:33:12 
- List: git
- Page: https://ratatoskr.run/git/2026/10/17835890
- Thread: https://ratatoskr.run/git/2026/09/17499453/t.md

```text
On 10/12/26 13:14, Christian Couder wrote:
>
> 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

```
