Thread (18 messages) flat view 18 messages, 5 authors, 2016-06-15

parse-options does not recognize "unspecified" behavior

From: Pranit Bauva <hidden>
Date: 2016-06-15 23:08:46

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?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help