commit: improve error message in "-a <paths>" case
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 20 Mar 2019 10:29:06 +0000 (17:29 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Mar 2019 07:44:37 +0000 (16:44 +0900)
I did something stupid today and got

$ git commit -a --fixup= @^
fatal: Paths with -a does not make sense.

which didn't make any sense (at least for the first few seconds).

Include the first path(spec) in the error message to help spot the
problem quicker. Now it shows

fatal: paths '@^ ...' with -a does not make sense

which should ring some bell because @^ should clearly not be considered
a path.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c
index 2986553d5ffb97f0798e4d4eb921073439fb9a92..48ddccaa3747006c55fffea7125ffdf5f5cb1cac 100644 (file)
@@ -1185,7 +1185,8 @@ static int parse_and_validate_options(int argc, const char *argv[],
        handle_untracked_files_arg(s);
 
        if (all && argc > 0)
-               die(_("Paths with -a does not make sense."));
+               die(_("paths '%s ...' with -a does not make sense"),
+                   argv[0]);
 
        if (status_format != STATUS_FORMAT_NONE)
                dry_run = 1;