DORMANTno replies

[PATCH] commit: improve error message in "-a <paths>" case

From: Nguyễn Thái Ngọc Duy <hidden>
Date: 2019-03-20 10:29:15
Subsystem: the rest · Maintainer: Linus Torvalds

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 <redacted>
---
 builtin/commit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index f17537474a..7f9aa032b6 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1194,7 +1194,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;
-- 
2.21.0.548.gd3c7d92dc2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help