Skip to content

Commit ed9c848

Browse files
avargitster
authored andcommitted
submodule--helper: don't use bitfield indirection for parse_options()
Do away with the indirection of local variables added in c51f8f9 (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]> Signed-off-by: Glen Choo <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a77c3fc commit ed9c848

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

builtin/submodule--helper.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,10 +2023,10 @@ struct update_data {
20232023
struct object_id suboid;
20242024
struct submodule_update_strategy update_strategy;
20252025
int depth;
2026-
unsigned int force: 1;
2027-
unsigned int quiet: 1;
2028-
unsigned int nofetch: 1;
2029-
unsigned int just_cloned: 1;
2026+
unsigned int force;
2027+
unsigned int quiet;
2028+
unsigned int nofetch;
2029+
unsigned int just_cloned;
20302030
};
20312031
#define UPDATE_DATA_INIT { .update_strategy = SUBMODULE_UPDATE_STRATEGY_INIT }
20322032

@@ -2578,16 +2578,17 @@ static int update_clone(int argc, const char **argv, const char *prefix)
25782578

25792579
static int run_update_procedure(int argc, const char **argv, const char *prefix)
25802580
{
2581-
int force = 0, quiet = 0, nofetch = 0, just_cloned = 0;
25822581
char *prefixed_path, *update = NULL;
25832582
struct update_data update_data = UPDATE_DATA_INIT;
25842583

25852584
struct option options[] = {
2586-
OPT__QUIET(&quiet, N_("suppress output for update by rebase or merge")),
2587-
OPT__FORCE(&force, N_("force checkout updates"), 0),
2588-
OPT_BOOL('N', "no-fetch", &nofetch,
2585+
OPT__QUIET(&update_data.quiet,
2586+
N_("suppress output for update by rebase or merge")),
2587+
OPT__FORCE(&update_data.force, N_("force checkout updates"),
2588+
0),
2589+
OPT_BOOL('N', "no-fetch", &update_data.nofetch,
25892590
N_("don't fetch new objects from the remote site")),
2590-
OPT_BOOL(0, "just-cloned", &just_cloned,
2591+
OPT_BOOL(0, "just-cloned", &update_data.just_cloned,
25912592
N_("overrides update mode in case the repository is a fresh clone")),
25922593
OPT_INTEGER(0, "depth", &update_data.depth, N_("depth for shallow fetch")),
25932594
OPT_STRING(0, "prefix", &prefix,
@@ -2615,10 +2616,6 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
26152616
if (argc != 1)
26162617
usage_with_options(usage, options);
26172618

2618-
update_data.force = !!force;
2619-
update_data.quiet = !!quiet;
2620-
update_data.nofetch = !!nofetch;
2621-
update_data.just_cloned = !!just_cloned;
26222619
update_data.sm_path = argv[0];
26232620

26242621
if (update_data.recursive_prefix)

0 commit comments

Comments
 (0)