parse-options does not recognize "unspecified" behavior
- From
Pranit Bauva <pranit.bauva@gmail.com>
- Date
- Mar 16, 2016, 19:51 UTC
- Message-ID
- <CAFZEwPPd2wFqFq2LFEzN2CzhTV6C420SLPcXi1SWE=z2epOYLw@mail.gmail.com>
Hey!
I noticed that parse-options does not recognize the variable which is set to -1 so as to denote the "unspecified" value.
I did the following changes in builtin/commit.c (in master branch not the patch I am working on) : - static int verbose = -1 - introduced a printf statement after parsing the options to print the value of verbose.
When I ran `git commit` : I get the output that verbose is set to -1.
When I ran `git commit -v` : I get the output that verbose is set to 0.
When I ran `git commit -v -v` : I get the output that verbose is set to 1.
When I ran `git commit --no-verbose` : I get the out that verbose is set to 0.
Then I set verbose = -2. And the output was obtained in a similar format. -2 with `git commit` -1 with `git commit -v` 0 with `git commit -v -v` 0 with `git commit --no-verbose` 1 with `git commit -v -v -v`
It seems that parse-options just increments the value without considering the -1 flag to denote "unspecified value".
Is this a bug?