Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-04 Thread Junio C Hamano
It is easy to overlook an already assigned single-letter option name and try to use it for a new one. Help the developer to catch it before such a mistake escapes the lab. This retroactively forbids any short option name (which is defined to be of type "int") outside the ASCII printable range. W

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-04 Thread Junio C Hamano
René Scharfe writes: >> Not quite, as an opt with long name is reported with the long name >> only, which is not very nice when the problem we are reporting is >> about its short variant. > > Perhaps something like the patch below helps, here and in general? Excellent. Not just this particular

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread René Scharfe
Am 04.09.2014 um 00:16 schrieb Junio C Hamano: > René Scharfe writes: > >>> It bugged me enough that we didn't identify which short option >>> letter we were complaining about >> >> The old code did report the short option. E.g. for t1502 it said: >> >> error: BUG: switch 'b' short name alr

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread Junio C Hamano
René Scharfe writes: >> It bugged me enough that we didn't identify which short option >> letter we were complaining about > > The old code did report the short option. E.g. for t1502 it said: > > error: BUG: switch 'b' short name already used > > You can leave that to optbug(), no need fo

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread Jonathan Nieder
On Wed, Sep 03, 2014 at 02:46:25PM -0700, Jonathan Nieder wrote: > Junio C Hamano wrote: > > > --- a/parse-options.c > > +++ b/parse-options.c > > @@ -345,12 +345,27 @@ static void check_typos(const char *arg, const struct > > option *options) > > static void parse_options_check(const struct opt

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread René Scharfe
bject: [PATCH] parse-options: detect attempt to add a duplicate short option name It is easy to overlook an already assigned single-letter option name and try to use it for a new one. Help the developer to catch it before such a mistake escapes the lab. Helped-by: René Scharfe Signed-off-by: J

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread Jonathan Nieder
Junio C Hamano wrote: > --- a/parse-options.c > +++ b/parse-options.c > @@ -345,12 +345,27 @@ static void check_typos(const char *arg, const struct > option *options) > static void parse_options_check(const struct option *opts) > { > int err = 0; > + char short_opts[128]; > + > +

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread Junio C Hamano
usefulness. We might want to tighten the type of the short_name member to unsigned char, but I didn't go that far yet, at least in this step. -- >8 -- Subject: [PATCH] parse-options: detect attempt to add a duplicate short option name It is easy to overlook an already assigned single-le

Re: [PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread René Scharfe
Am 03.09.2014 um 21:42 schrieb Junio C Hamano: > Junio C Hamano writes: > >>> diff --git a/builtin/revert.c b/builtin/revert.c >>> index f9ed5bd..831c2cd 100644 >>> --- a/builtin/revert.c >>> +++ b/builtin/revert.c >>> @@ -91,6 +91,7 @@ static void parse_args(int argc, const char **argv, >>> str

[PATCH] parse-options: detect attempt to add a duplicate short option name

2014-09-03 Thread Junio C Hamano
Junio C Hamano writes: >> diff --git a/builtin/revert.c b/builtin/revert.c >> index f9ed5bd..831c2cd 100644 >> --- a/builtin/revert.c >> +++ b/builtin/revert.c >> @@ -91,6 +91,7 @@ static void parse_args(int argc, const char **argv, struct >> replay_opts *opts) >> N_("option