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

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

From
Duy Nguyen <pclouds@gmail.com>
Date
Mar 21, 2019, 09:42 UTC
Message-ID
<CACsJy8CbpQs6_vH9P2T_BY8F3RHv0Y1M8NL-q0HNj7xOz4Wcjg@mail.gmail.com>
In-Reply-To
<xmqqh8bwsrnj.fsf@gitster-ct.c.googlers.com>
On Thu, Mar 21, 2019 at 12:49 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 20 quoted lines
>
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
> > 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?
Good point. I didn't think of this.

$ ./git commit -a --fixup= @^ -- foo fatal: paths '@^ ...' with -a does not make sense

so on the bright side the error message still reports the right thing.

But parseopt I think does something wrong because @^ should not be considered a path at all. There should be some other error message about unrecognized option "@^". I checked argv, argv[0] is "@^", argv[1] is "foo" and "--" stripped.

This I think is a separate bug. Will look into it when I have more time (and tagging #leftovers in case people look for something fun and small to do)

-- 
Duy
Previous: Junio C Hamano
Message 3 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.