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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 21, 2019 at 12:49 PM Junio C Hamano <gitster@xxxxxxxxx> wrote:
>
> Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux