submodule--helper: don't use bitfield indirection for parse_options()
Do away with the indirection of local variables added in c51f8f94e5b (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>
Ævar Arnfjörð Bjarmason committed
Mar 4, 2022 at 16:13 UTC
ed9c84853e99e2dbbb2b49898ca7badfe1686474
1 file changed
+10
-13
builtin/submodule--helper.c
+10
-13
@@ -2023,10 +2023,10 @@ struct update_data {
2023
struct object_id suboid;
2024
struct submodule_update_strategy update_strategy;
2025
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;
2030
};
2031
#define UPDATE_DATA_INIT { .update_strategy = SUBMODULE_UPDATE_STRATEGY_INIT }
2032
@@ -2578,16 +2578,17 @@ static int update_clone(int argc, const char **argv, const char *prefix)
2578
2579
static int run_update_procedure(int argc, const char **argv, const char *prefix)
2580
{
2581
- int force = 0, quiet = 0, nofetch = 0, just_cloned = 0;
2581
char *prefixed_path, *update = NULL;
2582
struct update_data update_data = UPDATE_DATA_INIT;
2583
2584
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,
2590
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,
2592
N_("overrides update mode in case the repository is a fresh clone")),
2593
OPT_INTEGER(0, "depth", &update_data.depth, N_("depth for shallow fetch")),
2594
OPT_STRING(0, "prefix", &prefix,
@@ -2615,10 +2616,6 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
2616
if (argc != 1)
2617
usage_with_options(usage, options);
2618
2618
- update_data.force = !!force;
2619
- update_data.quiet = !!quiet;
2620
- update_data.nofetch = !!nofetch;
2621
- update_data.just_cloned = !!just_cloned;
2619
update_data.sm_path = argv[0];
2620
2621
if (update_data.recursive_prefix)