From: Junio C Hamano <gitster@pobox.com>
To: Kaartic Sivaraam <kaartic.sivaraam@gmail.com>
Cc: git@vger.kernel.org, Jonathan Nieder <jrnieder@gmail.com>,
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
Subject: Re: [PATCH v2] setup: update error message to be more meaningful
Date: Tue, 03 Oct 2017 09:32:21 +0900 [thread overview]
Message-ID: <xmqq7ewdm5pm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20171002173002.4278-1-kaarticsivaraam@gmail.com> (Kaartic Sivaraam's message of "Mon, 2 Oct 2017 23:00:02 +0530")
Kaartic Sivaraam <kaartic.sivaraam@gmail.com> writes:
> Incorrect case,
>
> $ git grep "some random regex" -n
> fatal: bad flag '-n' used after filename
>
> The above case is incorrect as "some random regex" isn't a filename
> in this case.
The command line rule is to have dashed options first and then other
arguments, so I agree that "option '-n' used after non-option
argument(s)" would be a better alternative.
"grep" is an oddball, as it allows you to be lazy and omit the "-e"
option when there is only one pattern, making a perfectly reasonable
"grep -e regex -n" into an invalid "grep regex -n".
As an aside, I wonder if we want to _() the message. It's outside
the scope of this fix, obviously.
> setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/setup.c b/setup.c
> index 860507e1f..09c793282 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -230,7 +230,7 @@ void verify_filename(const char *prefix,
> int diagnose_misspelt_rev)
> {
> if (*arg == '-')
> - die("bad flag '%s' used after filename", arg);
> + die("option '%s' must come before non-option arguments", arg);
> if (looks_like_pathspec(arg) || check_filename(prefix, arg))
> return;
> die_verify_filename(prefix, arg, diagnose_misspelt_rev);
next prev parent reply other threads:[~2017-10-03 0:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-25 17:57 [PATCH/RFC] setup: update error message to be more meaningful Kaartic Sivaraam
2017-07-25 18:16 ` Kaartic Sivaraam
2017-07-25 21:21 ` Jonathan Nieder
2017-07-26 13:08 ` Kaartic Sivaraam
2017-07-26 20:09 ` Junio C Hamano
2017-07-29 2:44 ` Kaartic Sivaraam
2017-07-29 3:53 ` Junio C Hamano
2017-07-29 12:13 ` Kaartic Sivaraam
2017-07-29 12:41 ` [PATCH] " Kaartic Sivaraam
2017-07-29 16:10 ` [PATCH/RFC] " Junio C Hamano
2017-07-30 10:47 ` Kaartic Sivaraam
2017-07-30 11:03 ` Kaartic Sivaraam
2017-10-02 17:30 ` [PATCH v2] " Kaartic Sivaraam
2017-10-03 0:32 ` Junio C Hamano [this message]
2017-10-04 14:18 ` Kaartic Sivaraam
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=xmqq7ewdm5pm.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=kaarticsivaraam91196@gmail.com \
/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).