Re: range-diff: slight usability problem with mistyped ref
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 4, 2023, 20:20 UTC
- Message-ID
- <b8e9b054-4cd5-9c65-a397-088143d2fdc4@gmx.de>
- In-Reply-To
- <de43cd37-bfa5-4dbc-84d5-9362e9af6a9a@app.fastmail.com>
Hi Kristoffer,
On Mon, 3 Apr 2023, Kristoffer Haugsbakk wrote:
Show 14 quoted lines
> 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