env--helper: write to opt->value in parseopt helper
commit424e28fcadfe0a40e444687c10fb4eaff8360f8d
authorJeff King <peff@peff.net>
Wed, 30 Sep 2020 12:28:32 +0000 (30 08:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 Sep 2020 19:53:47 +0000 (30 12:53 -0700)
tree662e00673b62495221049c3bd2dd556bbcd77355
parente885a84f1bc660adfc1dea5f6c25d0a92c7c9dbc
env--helper: write to opt->value in parseopt helper

We use OPT_CALLBACK_F() to call the option_parse_type() callback,
passing it the address of "cmdmode" as the value to write to. But the
callback doesn't look at opt->value at all, and instead writes to a
global variable.

This works out because that's the same global variable we happen to pass
in, but it's rather confusing.  Let's use the passed-in value instead.
We'll also make "cmdmode" a local variable of the main function,
ensuring we can't make the same mistake again.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/env--helper.c