git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 21, 2019, 05:49 UTC
Message-ID
<xmqqh8bwsrnj.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20190320102906.12917-1-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 14 quoted lines
> 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.

Makes sort of sense. Would it break to blindly use argv[0] if the user had an explicit double-dash "--" disambiguator?

Show 20 quoted lines
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  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;
Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 2 of 3 in “commit: improve error message in "-a <paths>" case”
  1. commit: improve error message in "-a <paths>" caseNguyễn Thái Ngọc Duy, Mar 20, 2019
  2. Junio C HamanoMar 21, 2019
  3. Duy NguyenMar 21, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.