builtin/submodule--helper.c: rename option struct to "opt"

In a later commit, update_clone()'s options will be stored in a struct update_data instead of submodule_update_clone. Preemptively rename the options struct to "opt" to shrink that commit's diff. Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> 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 15, 2022 at 14:09 UTC 49fd5b99a59621bf4428ea648b6656c126298212
1 file changed +26 -26
builtin/submodule--helper.c
+26 -26
@@ -2498,40 +2498,40 @@ static int update_clone(int argc, const char **argv, const char *prefix)
2498 {
2499 const char *update = NULL;
2500 struct pathspec pathspec;
2501 - struct submodule_update_clone suc = SUBMODULE_UPDATE_CLONE_INIT;
2501 + struct submodule_update_clone opt = SUBMODULE_UPDATE_CLONE_INIT;
2502 struct list_objects_filter_options filter_options;
2503 int ret;
2504
2505 struct option module_update_clone_options[] = {
2506 - OPT_BOOL(0, "init", &suc.init,
2506 + OPT_BOOL(0, "init", &opt.init,
2507 N_("initialize uninitialized submodules before update")),
2508 OPT_STRING(0, "prefix", &prefix,
2509 N_("path"),
2510 N_("path into the working tree")),
2511 - OPT_STRING(0, "recursive-prefix", &suc.recursive_prefix,
2511 + OPT_STRING(0, "recursive-prefix", &opt.recursive_prefix,
2512 N_("path"),
2513 N_("path into the working tree, across nested "
2514 "submodule boundaries")),
2515 OPT_STRING(0, "update", &update,
2516 N_("string"),
2517 N_("rebase, merge, checkout or none")),
2518 - OPT_STRING_LIST(0, "reference", &suc.references, N_("repo"),
2518 + OPT_STRING_LIST(0, "reference", &opt.references, N_("repo"),
2519 N_("reference repository")),
2520 - OPT_BOOL(0, "dissociate", &suc.dissociate,
2520 + OPT_BOOL(0, "dissociate", &opt.dissociate,
2521 N_("use --reference only while cloning")),
2522 - OPT_STRING(0, "depth", &suc.depth, "<depth>",
2522 + OPT_STRING(0, "depth", &opt.depth, "<depth>",
2523 N_("create a shallow clone truncated to the "
2524 "specified number of revisions")),
2525 - OPT_INTEGER('j', "jobs", &suc.max_jobs,
2525 + OPT_INTEGER('j', "jobs", &opt.max_jobs,
2526 N_("parallel jobs")),
2527 - OPT_BOOL(0, "recommend-shallow", &suc.recommend_shallow,
2527 + OPT_BOOL(0, "recommend-shallow", &opt.recommend_shallow,
2528 N_("whether the initial clone should follow the shallow recommendation")),
2529 - OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
2530 - OPT_BOOL(0, "progress", &suc.progress,
2529 + OPT__QUIET(&opt.quiet, N_("don't print cloning progress")),
2530 + OPT_BOOL(0, "progress", &opt.progress,
2531 N_("force cloning progress")),
2532 - OPT_BOOL(0, "require-init", &suc.require_init,
2532 + OPT_BOOL(0, "require-init", &opt.require_init,
2533 N_("disallow cloning into non-empty directory")),
2534 - OPT_BOOL(0, "single-branch", &suc.single_branch,
2534 + OPT_BOOL(0, "single-branch", &opt.single_branch,
2535 N_("clone only one branch, HEAD or --branch")),
2536 OPT_PARSE_LIST_OBJECTS_FILTER(&filter_options),
2537 OPT_END()
@@ -2546,16 +2546,16 @@ static int update_clone(int argc, const char **argv, const char *prefix)
2546 " [--recursive] [--[no-]single-branch] [--] [<path>...]"),
2547 NULL
2548 };
2549 - suc.prefix = prefix;
2549 + opt.prefix = prefix;
2550
2551 - update_clone_config_from_gitmodules(&suc.max_jobs);
2552 - git_config(git_update_clone_config, &suc.max_jobs);
2551 + update_clone_config_from_gitmodules(&opt.max_jobs);
2552 + git_config(git_update_clone_config, &opt.max_jobs);
2553
2554 memset(&filter_options, 0, sizeof(filter_options));
2555 argc = parse_options(argc, argv, prefix, module_update_clone_options,
2556 git_submodule_helper_usage, 0);
2557
2558 - if (filter_options.choice && !suc.init) {
2558 + if (filter_options.choice && !opt.init) {
2559 /*
2560 * NEEDSWORK: Don't use usage_with_options() because the
2561 * usage string is for "git submodule update", but the
@@ -2567,25 +2567,25 @@ static int update_clone(int argc, const char **argv, const char *prefix)
2567 usage(git_submodule_helper_usage[0]);
2568 }
2569
2570 - suc.filter_options = &filter_options;
2570 + opt.filter_options = &filter_options;
2571
2572 if (update)
2573 - if (parse_submodule_update_strategy(update, &suc.update) < 0)
2573 + if (parse_submodule_update_strategy(update, &opt.update) < 0)
2574 die(_("bad value for update parameter"));
2575
2576 - if (module_list_compute(argc, argv, prefix, &pathspec, &suc.list) < 0) {
2576 + if (module_list_compute(argc, argv, prefix, &pathspec, &opt.list) < 0) {
2577 list_objects_filter_release(&filter_options);
2578 return 1;
2579 }
2580
2581 if (pathspec.nr)
2582 - suc.warn_if_uninitialized = 1;
2582 + opt.warn_if_uninitialized = 1;
2583
2584 - if (suc.init) {
2584 + if (opt.init) {
2585 struct module_list list = MODULE_LIST_INIT;
2586 struct init_cb info = INIT_CB_INIT;
2587
2588 - if (module_list_compute(argc, argv, suc.prefix,
2588 + if (module_list_compute(argc, argv, opt.prefix,
2589 &pathspec, &list) < 0)
2590 return 1;
2591
@@ -2596,15 +2596,15 @@ static int update_clone(int argc, const char **argv, const char *prefix)
2596 if (!argc && git_config_get_value_multi("submodule.active"))
2597 module_list_active(&list);
2598
2599 - info.prefix = suc.prefix;
2600 - info.superprefix = suc.recursive_prefix;
2601 - if (suc.quiet)
2599 + info.prefix = opt.prefix;
2600 + info.superprefix = opt.recursive_prefix;
2601 + if (opt.quiet)
2602 info.flags |= OPT_QUIET;
2603
2604 for_each_listed_submodule(&list, init_submodule_cb, &info);
2605 }
2606
2607 - ret = update_submodules(&suc);
2607 + ret = update_submodules(&opt);
2608 list_objects_filter_release(&filter_options);
2609 return ret;
2610 }