Skip to content

Commit 33f3c68

Browse files
Kaartic Sivaraamgitster
authored andcommitted
setup: update error message to be more meaningful
The error message shown when a flag is found when expecting a filename wasn't clear as it didn't communicate what was wrong using the 'suitable' words in *all* cases. $ git ls-files README.md test-file Correct case, $ git rev-parse README.md --flags README.md --flags fatal: bad flag '--flags' used after filename 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. Change the error message to be general and communicative. This results in the following output, $ git rev-parse README.md --flags README.md --flags fatal: option '--flags' must come before non-option arguments $ git grep "some random regex" -n fatal: option '-n' must come before non-option arguments Signed-off-by: Kaartic Sivaraam <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4010f1d commit 33f3c68

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

setup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void verify_filename(const char *prefix,
230230
int diagnose_misspelt_rev)
231231
{
232232
if (*arg == '-')
233-
die("bad flag '%s' used after filename", arg);
233+
die("option '%s' must come before non-option arguments", arg);
234234
if (looks_like_pathspec(arg) || check_filename(prefix, arg))
235235
return;
236236
die_verify_filename(prefix, arg, diagnose_misspelt_rev);

0 commit comments

Comments
 (0)