[PATCH/RFC] setup: update error message to be more meaningful
- From
Kaartic Sivaraam <kaarticsivaraam91196@gmail.com>
- Date
- Jul 25, 2017, 17:57 UTC
- Message-ID
- <0102015d7ae53b0a-a6505296-9257-4b0d-84d6-2152e17eb070-000000@eu-west-1.amazonses.com>
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.
Correct case,
$ git rev-parse commit.c --flags
commit.c
--flags
fatal: bad flag '--flags' used after filenameIncorrect case,
$ git grep "test" -n
fatal: bad flag '-n' used after filenameChange the error message to be general and communicative. This results in the following output,
$ git rev-parse commit.c --flags
commit.c
--flags
fatal: found flag '--flags' in place of a filename $ git grep "test" -n
fatal: found flag '-n' in place of a filenameSigned-off-by: Kaartic Sivaraam <kaarticsivaraam91196@gmail.com> --- setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/setup.c b/setup.c index 860507e1fdb2d..0433d7889e6b3 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("found flag '%s' in place of a filename", arg); if (looks_like_pathspec(arg) || check_filename(prefix, arg)) return; die_verify_filename(prefix, arg, diagnose_misspelt_rev); -- https://github.com/git/git/pull/388