]> git.ipfire.org Git - thirdparty/git.git/commit
show-branch: --no-sparse should give dense output
authorJunio C Hamano <gitster@pobox.com>
Wed, 19 Jul 2023 11:37:39 +0000 (04:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 19 Jul 2023 16:16:37 +0000 (09:16 -0700)
commit83bb8e5a0689e236f06a24ffede0b4c823b4a0b2
tree8f2f9e11fee38d4a7f44193289d969428c8f8a9a
parentfb7d80edcae482f4fa5d4be0227dc3054734e5f3
show-branch: --no-sparse should give dense output

"git show-branch --no-sparse" behaved exactly the same way as "git
show-branch --sparse", which did not make any sense.  This was
because it used a variable "dense" initialized to 1 by default to
give "non sparse" behaviour, and OPT_SET_INT() to set the varilable
to 0 in response to the "--sparse" option.  Unfortunately,
OPT_SET_INT() sets 0 to the given variable when the option is
negated.

Flip the polarity of the variable "dense" by renaming it to "sparse"
and initializing it to 0, and have OPT_SET_INT() set the variable to
1 when "--sparse" is given.  This way, "--no-sparse" would set 0 to
the variable and would give us the "dense" behaviour.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/show-branch.c
t/t3202-show-branch.sh