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