submodule--helper: don't use bitfield indirection for parse_options()
Do away with the indirection of local variables added in
c51f8f94e5
(submodule--helper: run update procedures from C,
2021-08-24).
These were only needed because in C you can't get a pointer to a
single bit, so we were using intermediate variables instead.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Glen Choo <chooglen@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a77c3fcb5e
commit
ed9c84853e
@ -2023,10 +2023,10 @@ struct update_data {
|
|||||||
struct object_id suboid;
|
struct object_id suboid;
|
||||||
struct submodule_update_strategy update_strategy;
|
struct submodule_update_strategy update_strategy;
|
||||||
int depth;
|
int depth;
|
||||||
unsigned int force: 1;
|
unsigned int force;
|
||||||
unsigned int quiet: 1;
|
unsigned int quiet;
|
||||||
unsigned int nofetch: 1;
|
unsigned int nofetch;
|
||||||
unsigned int just_cloned: 1;
|
unsigned int just_cloned;
|
||||||
};
|
};
|
||||||
#define UPDATE_DATA_INIT { .update_strategy = SUBMODULE_UPDATE_STRATEGY_INIT }
|
#define UPDATE_DATA_INIT { .update_strategy = SUBMODULE_UPDATE_STRATEGY_INIT }
|
||||||
|
|
||||||
@ -2578,16 +2578,17 @@ static int update_clone(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
static int run_update_procedure(int argc, const char **argv, const char *prefix)
|
static int run_update_procedure(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
int force = 0, quiet = 0, nofetch = 0, just_cloned = 0;
|
|
||||||
char *prefixed_path, *update = NULL;
|
char *prefixed_path, *update = NULL;
|
||||||
struct update_data update_data = UPDATE_DATA_INIT;
|
struct update_data update_data = UPDATE_DATA_INIT;
|
||||||
|
|
||||||
struct option options[] = {
|
struct option options[] = {
|
||||||
OPT__QUIET(&quiet, N_("suppress output for update by rebase or merge")),
|
OPT__QUIET(&update_data.quiet,
|
||||||
OPT__FORCE(&force, N_("force checkout updates"), 0),
|
N_("suppress output for update by rebase or merge")),
|
||||||
OPT_BOOL('N', "no-fetch", &nofetch,
|
OPT__FORCE(&update_data.force, N_("force checkout updates"),
|
||||||
|
0),
|
||||||
|
OPT_BOOL('N', "no-fetch", &update_data.nofetch,
|
||||||
N_("don't fetch new objects from the remote site")),
|
N_("don't fetch new objects from the remote site")),
|
||||||
OPT_BOOL(0, "just-cloned", &just_cloned,
|
OPT_BOOL(0, "just-cloned", &update_data.just_cloned,
|
||||||
N_("overrides update mode in case the repository is a fresh clone")),
|
N_("overrides update mode in case the repository is a fresh clone")),
|
||||||
OPT_INTEGER(0, "depth", &update_data.depth, N_("depth for shallow fetch")),
|
OPT_INTEGER(0, "depth", &update_data.depth, N_("depth for shallow fetch")),
|
||||||
OPT_STRING(0, "prefix", &prefix,
|
OPT_STRING(0, "prefix", &prefix,
|
||||||
@ -2615,10 +2616,6 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
usage_with_options(usage, options);
|
usage_with_options(usage, options);
|
||||||
|
|
||||||
update_data.force = !!force;
|
|
||||||
update_data.quiet = !!quiet;
|
|
||||||
update_data.nofetch = !!nofetch;
|
|
||||||
update_data.just_cloned = !!just_cloned;
|
|
||||||
update_data.sm_path = argv[0];
|
update_data.sm_path = argv[0];
|
||||||
|
|
||||||
if (update_data.recursive_prefix)
|
if (update_data.recursive_prefix)
|
||||||
|
Loading…
Reference in New Issue
Block a user