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

Re: [PATCH 2/6] bisect: fix "--" detection when a term name is "--"

From
Christian Couder <christian.couder@gmail.com>
Date
Sep 23, 2026, 08:11 UTC
Message-ID
<CAP8UFD3sh9Ejfgv7CB33LRU_z3i662_+tjdW7JqwRrzexWX_Ow@mail.gmail.com>
In-Reply-To
<xmqqse3rffr4.fsf@gitster.g>
On Thu, Sep 3, 2026 at 12:30 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
>
> Christian Couder <christian.couder@gmail.com> writes:
>
> > `bisect_start()` walks its arguments twice. The second loop actually
> > parses the options, and it knows that `--term-good`, `--term-old`,
> > `--term-bad` and `--term-new` take their value as a separate argument,
> > so it skips that value.
> >
> > The first loop, which only looks for the "--" separating revisions from
> > paths, doesn't know about these options. So when such an option is given
> > "--" as its value, that "--" is mistaken for the separator and
> > `has_double_dash` is wrongly set.
>
> It may be theoretically true, but I wonder how much practical value
> it has to correctly parse "--term-good --" as "Ah, the user wants to
> mark good revisions as '--' instead of 'good' or 'old'"?  Even
> though "refs/bisect/--" is *not* forbidden, how likely is it for
> users to do that?
>
> This is not like "git grep -e --" which does have much more pracical
> value.
Right, this patch and the next one have been removed from v2.

In the future we can still convert bisect_start() to the parse-options API, and then use the early-scan API to look for "--" in a bit cleaner way.

Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 21 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. 3/3 fast-import: use early_scan_options() for --allow-unsafe-featuresChristian Couder, Sep 23, 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.