git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH v2 3/3] range-diff: optionally accept pathspecs
Date: Fri, 26 Aug 2022 10:02:18 -0700	[thread overview]
Message-ID: <xmqq1qt3ym3p.fsf@gitster.g> (raw)
In-Reply-To: <a52ad40e0155caf8285b86ec26bbd47cd2240466.1661506770.git.gitgitgadget@gmail.com> (Johannes Schindelin via GitGitGadget's message of "Fri, 26 Aug 2022 09:39:30 +0000")

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

> +	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.

      reply	other threads:[~2022-08-26 17:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-23 12:35 [PATCH 0/2] Allow passing pathspecs to git range-diff Johannes Schindelin via GitGitGadget
2022-08-23 12:35 ` [PATCH 1/2] range-diff: reorder argument handling Johannes Schindelin via GitGitGadget
2022-08-23 12:35 ` [PATCH 2/2] range-diff: optionally accept a pathspec Johannes Schindelin via GitGitGadget
2022-08-24 21:00   ` Junio C Hamano
2022-08-26  9:39 ` [PATCH v2 0/3] Allow passing pathspecs to git range-diff Johannes Schindelin via GitGitGadget
2022-08-26  9:39   ` [PATCH v2 1/3] range-diff: reorder argument handling Johannes Schindelin via GitGitGadget
2022-08-26  9:39   ` [PATCH v2 2/3] range-diff: consistently validate the arguments Johannes Schindelin via GitGitGadget
2022-08-26 16:54     ` Junio C Hamano
2022-08-26  9:39   ` [PATCH v2 3/3] range-diff: optionally accept pathspecs Johannes Schindelin via GitGitGadget
2022-08-26 17:02     ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq1qt3ym3p.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).