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

Re: [PATCH v2 3/3] range-diff: optionally accept pathspecs

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2022, 17:02 UTC
Message-ID
<xmqq1qt3ym3p.fsf@gitster.g>
In-Reply-To
<a52ad40e0155caf8285b86ec26bbd47cd2240466.1661506770.git.gitgitgadget@gmail.com>

"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com> writes:

Show 17 quoted lines
> +	for (i = 0; i < argc; i++)
> +		if (!strcmp(argv[i], "--")) {
> +			dash_dash = i;
> +			break;
> +		}
> +
> +	if (dash_dash == 3 ||
> +	    (dash_dash < 0 && argc > 2 &&
> +	     !get_oid_committish(argv[0], &oid) &&
> +	     !get_oid_committish(argv[1], &oid) &&
> +	     !get_oid_committish(argv[2], &oid))) {
> +		if (dash_dash < 0)
> +			; /* already validated arguments */
> +		else if (get_oid_committish(argv[0], &oid))
>  			usage_msg_optf(_("not a revision: '%s'"),
>  				       builtin_range_diff_usage, options,
>  				       argv[0]);

Very reasonable. We won't ever have "--" on the command line as anything but a dash-dash (i.e. there is no option to the command that can take any string), and thanks to the previous step, this addition falls in place very naturally. Very nicely done.

Will replace. I _think_ this is ready for 'next', but let's see if others spot problems for a few days.

THanks.
Previous: Johannes Schindelin via GitGitGadget
Message 10 of 10 in “Allow passing pathspecs to git range-diff”
  1. 0/2 Allow passing pathspecs to git range-diffJohannes Schindelin via GitGitGadget, Aug 23, 2022
  2. 1/2 range-diff: reorder argument handlingJohannes Schindelin via GitGitGadget, Aug 23, 2022
  3. 2/2 range-diff: optionally accept a pathspecJohannes Schindelin via GitGitGadget, Aug 23, 2022
  4. Junio C HamanoAug 24, 2022
  5. 0/3 Allow passing pathspecs to git range-diffJohannes Schindelin via GitGitGadget, Aug 26, 2022
  6. 1/3 range-diff: reorder argument handlingJohannes Schindelin via GitGitGadget, Aug 26, 2022
  7. 2/3 range-diff: consistently validate the argumentsJohannes Schindelin via GitGitGadget, Aug 26, 2022
  8. Junio C HamanoAug 26, 2022
  9. 3/3 range-diff: optionally accept pathspecsJohannes Schindelin via GitGitGadget, Aug 26, 2022
  10. Junio C HamanoAug 26, 2022

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.