# [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE

6 messages from 2014-02-28 to 2014-02-28. Participants: Sun He, 孙赫, Duy Nguyen, Junio C Hamano, He Sun.
Thread: https://gitlist.dev/t/35994

## Sun He, 2014-02-28 14:29

Subject: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <1393597765-14164-1-git-send-email-sunheehnus@gmail.com>
URL: https://gitlist.dev/e/1393597765-14164-1-git-send-email-sunheehnus%40gmail.com

```
Signed-off-by: Sun He <sunheehnus@gmail.com>
---
 parse-options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/parse-options.c b/parse-options.c
index 7b8d3fa..59a52b0 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
 		case OPTION_NEGBIT:
 		case OPTION_SET_INT:
 		case OPTION_SET_PTR:
-		case OPTION_NUMBER:
+		case OPTION_CMDMODE:
 			if ((opts->flags & PARSE_OPT_OPTARG) ||
 			    !(opts->flags & PARSE_OPT_NOARG))
 				err |= optbug(opts, "should not accept an argument");
-- 
1.9.0.138.g2de3478.dirty
---
I came across this protential bug.
According to parse-options.h OPTION_CMDMODE is an option with noarguments and OPTION_NUMBER is special type option.

Thanks,
He Sun

```

## 孙赫, 2014-02-28 14:32

Subject: Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <CAJr59C1qHrQ9qPdDWfGzj9QX3L-EwEcP+updu0SDn24r4i7UMQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAJr59C1qHrQ9qPdDWfGzj9QX3L-EwEcP%2Bupdu0SDn24r4i7UMQ%40mail.gmail.com
In-Reply-To: <1393597765-14164-1-git-send-email-sunheehnus@gmail.com>

```
I am not sure if this is a bug.
I need your help to find out it.

Cheers,
He Sun

2014-02-28 22:29 GMT+08:00 Sun He <sunheehnus@gmail.com>:
> Signed-off-by: Sun He <sunheehnus@gmail.com>
> ---
>  parse-options.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/parse-options.c b/parse-options.c
> index 7b8d3fa..59a52b0 100644
> --- a/parse-options.c
> +++ b/parse-options.c
> @@ -371,7 +371,7 @@ static void parse_options_check(const struct option *opts)
>                 case OPTION_NEGBIT:
>                 case OPTION_SET_INT:
>                 case OPTION_SET_PTR:
> -               case OPTION_NUMBER:
> +               case OPTION_CMDMODE:
>                         if ((opts->flags & PARSE_OPT_OPTARG) ||
>                             !(opts->flags & PARSE_OPT_NOARG))
>                                 err |= optbug(opts, "should not accept an argument");
> --
> 1.9.0.138.g2de3478.dirty
> ---
> I came across this protential bug.
> According to parse-options.h OPTION_CMDMODE is an option with noarguments and OPTION_NUMBER is special type option.
>
> Thanks,
> He Sun

```

## Duy Nguyen, 2014-02-28 14:42

Subject: Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <CACsJy8BM=m6=tv2P6F3EAcVPupovSTKC3s+5gkus3V+GZ4owRw@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8BM%3Dm6%3Dtv2P6F3EAcVPupovSTKC3s%2B5gkus3V%2BGZ4owRw%40mail.gmail.com
In-Reply-To: <CAJr59C1qHrQ9qPdDWfGzj9QX3L-EwEcP+updu0SDn24r4i7UMQ@mail.gmail.com>

```
Way too long subject line. Keep it within 70-75 chars. The rest could
be put in the body.

On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <sunheehnus@gmail.com> wrote:
> I am not sure if this is a bug.
> I need your help to find out it.

Tip:git has a wonderful history (most of it anyway). Try "git log
--patch parse-options.[ch]" to understand parse-options evolution. Add
-SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
diff contains that keyword.
-- 
Duy

```

## 孙赫, 2014-02-28 15:21

Subject: Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <CAJr59C2Rd4JDUe-UMcjg6=z2fVDc45pSHZwKB_aA-X2p1PkQvw@mail.gmail.com>
URL: https://gitlist.dev/e/CAJr59C2Rd4JDUe-UMcjg6%3Dz2fVDc45pSHZwKB_aA-X2p1PkQvw%40mail.gmail.com
In-Reply-To: <CACsJy8BM=m6=tv2P6F3EAcVPupovSTKC3s+5gkus3V+GZ4owRw@mail.gmail.com>

```
2014-02-28 22:43 GMT+08:00 Duy Nguyen [via git]
<ml-node+s661346n7604517h28@n2.nabble.com>:
> Way too long subject line. Keep it within 70-75 chars. The rest could
> be put in the body.
>
> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <[hidden email]> wrote:
>> I am not sure if this is a bug.
>> I need your help to find out it.
>
> Tip:git has a wonderful history (most of it anyway). Try "git log
> --patch parse-options.[ch]" to understand parse-options evolution. Add
> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
> diff contains that keyword.
> --
> Duy
> --
Got it,
Thanks

> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://git.661346.n2.nabble.com/PATCH-OPTION-CMDMODE-should-be-used-when-not-accept-an-argument-and-OPTION-NUMBER-is-of-special-typeE-tp7604513p7604517.html
> To start a new topic under git, email
> ml-node+s661346n661346h27@n2.nabble.com
> To unsubscribe from git, click here.
> NAML

```

## Junio C Hamano, 2014-02-28 20:02

Subject: Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <xmqqsir3t39f.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqsir3t39f.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CACsJy8BM=m6=tv2P6F3EAcVPupovSTKC3s+5gkus3V+GZ4owRw@mail.gmail.com>

```
Duy Nguyen <pclouds@gmail.com> writes:

> Way too long subject line. Keep it within 70-75 chars. The rest could
> be put in the body.
>
> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <sunheehnus@gmail.com> wrote:
>> I am not sure if this is a bug.
>> I need your help to find out it.
>
> Tip:git has a wonderful history (most of it anyway). Try "git log
> --patch parse-options.[ch]" to understand parse-options evolution. Add
> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
> diff contains that keyword.

Also, I do not think this should be done in a single patch.  What if
it turns out that explicitly making sure that CMDMODE does not take
any argument is a good idea, but the other change is a bad one?

```

## He Sun, 2014-02-28 23:50

Subject: Re: [PATCH] OPTION_CMDMODE should be used when not accept an argument, and OPTION_NUMBER is of special type. So change the mode to OPTION_CMDMODE
Message-ID: <CAJr59C097u0HK5RqmZj6rUTAgeoSMjpoCJR_NGHiot02tQHDMg@mail.gmail.com>
URL: https://gitlist.dev/e/CAJr59C097u0HK5RqmZj6rUTAgeoSMjpoCJR_NGHiot02tQHDMg%40mail.gmail.com
In-Reply-To: <xmqqsir3t39f.fsf@gitster.dls.corp.google.com>

```
2014-03-01 4:02 GMT+08:00 Junio C Hamano [via git]
<ml-node+s661346n7604560h61@n2.nabble.com>:
> Duy Nguyen <[hidden email]> writes:
>
>> Way too long subject line. Keep it within 70-75 chars. The rest could
>> be put in the body.
>>
>> On Fri, Feb 28, 2014 at 9:32 PM, 孙赫 <[hidden email]> wrote:
>>> I am not sure if this is a bug.
>>> I need your help to find out it.
>>
>> Tip:git has a wonderful history (most of it anyway). Try "git log
>> --patch parse-options.[ch]" to understand parse-options evolution. Add
>> -SOPTION_NUMBER (or -SOPTION_CMDMODE) to limit to only commits whose
>> diff contains that keyword.
>
> Also, I do not think this should be done in a single patch.  What if
> it turns out that explicitly making sure that CMDMODE does not take
> any argument is a good idea, but the other change is a bad one?

OK, I will try to figure it out.

> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to [hidden email]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
> ________________________________
> If you reply to this email, your message will be added to the discussion
> below:
> http://git.661346.n2.nabble.com/PATCH-OPTION-CMDMODE-should-be-used-when-not-accept-an-argument-and-OPTION-NUMBER-is-of-special-typeE-tp7604513p7604560.html
> To start a new topic under git, email
> ml-node+s661346n661346h27@n2.nabble.com
> To unsubscribe from git, click here.
> NAML

```
