git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Kristoffer Haugsbakk <code@khaugsbakk.name>
Cc: git@vger.kernel.org
Subject: Re: range-diff: slight usability problem with mistyped ref
Date: Tue, 4 Apr 2023 22:20:15 +0200 (CEST)	[thread overview]
Message-ID: <b8e9b054-4cd5-9c65-a397-088143d2fdc4@gmx.de> (raw)
In-Reply-To: <de43cd37-bfa5-4dbc-84d5-9362e9af6a9a@app.fastmail.com>

[-- Attachment #1: Type: text/plain, Size: 1851 bytes --]

Hi Kristoffer,

On Mon, 3 Apr 2023, Kristoffer Haugsbakk wrote:

> On Tue, Mar 28, 2023, at 13:37, Johannes Schindelin wrote:
> > So even making the exact error message depend on the number of
> > arguments could result in misleading error message.
>
> Yeah, I see. It seems that the variadic nature of the command makes it
> difficult to guess what the user might have meant in all cases.
>
> > Do you have any splendid idea how to phrase the error message (or
> > adapt it to the concrete invocation)?
>
> No. I was going to look more closely at that if-else chain, but given
> the fact that I don’t know C and all the cases that would need to be
> covered (“what if the third argument happens to match both a ref and a
> file?”) I wouldn’t get anywhere.

Knowledge of C is not required to come up with an error message ;-)

The forms in which `git range-diff` can be called are:

	git range-diff A...B [[--] <path>...]
	git range-diff A..B C..D [[--] <path>...]
	git range-diff A B C [[--] <path>...]

In general, I find it hard to guess which form was meant when a typo
causes an error message. For example, `git range-diff A..B C` might have
been intended to be the three-rev form `A B C`, but it could also have
been intended to pass two commit ranges `A..B HEAD..C`.

As such, I wonder whether we can just cleverly _avoid_ saying _which_ form
we suspect the user to have intended.

In other words, instead of

	need two commit ranges

we could say:

	`range-diff` needs three revs, two ranges or a symmetric range

Since this does not require any C expertise, it would probably be a good
idea to let C experts work on other patches, patches that do require their
expertise: The patch to improve the error message does not require any
knowledge of the C language at all.

Ciao,
Johannes

      reply	other threads:[~2023-04-04 20:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-25 10:04 range-diff: slight usability problem with mistyped ref Kristoffer Haugsbakk
2023-03-28 11:37 ` Johannes Schindelin
2023-04-03 19:29   ` Kristoffer Haugsbakk
2023-04-04 20:20     ` Johannes Schindelin [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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=b8e9b054-4cd5-9c65-a397-088143d2fdc4@gmx.de \
    --to=johannes.schindelin@gmx.de \
    --cc=code@khaugsbakk.name \
    --cc=git@vger.kernel.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).