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

Re: [PATCH 3/3] revision: handle pseudo-opts in `--stdin` mode

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2023, 15:56 UTC
Message-ID
<xmqq352uyr5b.fsf@gitster.g>
In-Reply-To
<457591712799719f23fa47e59d5a3c1cd497e802.1686744685.git.ps@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 14 quoted lines
>  		if (sb.buf[0] == '-') {
> +			const char *argv[2] = { sb.buf, NULL };
> +
>  			if (!strcmp(sb.buf, "--")) {
>  				seen_dashdash = 1;
>  				break;
>  			}
>  
> -			die("options not supported in --stdin mode");
> +			if (handle_revision_pseudo_opt(revs, argv, flags))
> +				continue;
> +
> +			die(_("option '%s' not supported in --stdin mode"), sb.buf);
>  		}

The reason why we had the double-dash checking inside this block is because we rejected any dashed options other than double-dash, but with this step, that is no longer true, so it may make more sense to move the "seen_dashdash" code outside the block. Also unlike the command line options that allows "--end-of-options" marker to allow tweaking how a failing handle_revision_arg() call is handled, this codepath does not seem to have any matching provision. In the original code, which did not accept any options, it was perfectly understandable that it was unaware of "--end-of-options", but now we do allow dashed options, shouldn't we be supporting it here, too?

Thanks.
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 7 of 12 in “revision: handle pseudo-opts in `--stdin` mode”
  1. 0/3 revision: handle pseudo-opts in `--stdin` modePatrick Steinhardt, Jun 14, 2023
  2. 1/3 revision: reorder `read_revisions_from_stdin()`Patrick Steinhardt, Jun 14, 2023
  3. Junio C HamanoJun 14, 2023
  4. 2/3 revision: small readability improvement for reading from stdinPatrick Steinhardt, Jun 14, 2023
  5. Junio C HamanoJun 14, 2023
  6. 3/3 revision: handle pseudo-opts in `--stdin` modePatrick Steinhardt, Jun 14, 2023
  7. Junio C HamanoJun 14, 2023
  8. Patrick SteinhardtJun 15, 2023
  9. 0/3 revision: handle pseudo-opts in `--stdin` modePatrick Steinhardt, Jun 15, 2023
  10. 1/3 revision: reorder `read_revisions_from_stdin()`Patrick Steinhardt, Jun 15, 2023
  11. 3/3 revision: handle pseudo-opts in `--stdin` modePatrick Steinhardt, Jun 15, 2023
  12. 2/3 revision: small readability improvement for reading from stdinPatrick Steinhardt, Jun 15, 2023

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.