diff mbox series

[RFC,15/20] submodule--helper: understand -v option for "update"

Message ID RFC-patch-15.20-0c388eed1d1-20220610T011725Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series submodule: remove git-submodule.sh, create bare builtin/submodule.c | expand

Commit Message

Ævar Arnfjörð Bjarmason June 10, 2022, 2:01 a.m. UTC
Change the "OPT__QUIET()" in module_update() to use OPT__VERBOSITY()
instead. This is in preparation for passing the command in
"git-submodule.sh" to "git submodule update" directly.

Note that this implementation supports the "--verbose" synonym for
"-v", but "git-submodule.sh" does not. Once we make the switch to
calling "git submodule--helper update" directly we should update the
documentation to reflect that.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/submodule--helper.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 64d7c5d7ba4..94126bcca07 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2584,6 +2584,7 @@  static int module_update(int argc, const char **argv, const char *prefix)
 	struct list_objects_filter_options filter_options;
 	int ret;
 	enum submodule_update_type update_type = SM_UPDATE_UNSPECIFIED;
+	int verbosity = 0;
 
 	struct option module_update_options[] = {
 		OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
@@ -2625,7 +2626,7 @@  static int module_update(int argc, const char **argv, const char *prefix)
 			    N_("parallel jobs")),
 		OPT_BOOL(0, "recommend-shallow", &opt.recommend_shallow,
 			    N_("whether the initial clone should follow the shallow recommendation")),
-		OPT__QUIET(&opt.quiet, N_("don't print cloning progress")),
+		OPT__VERBOSITY(&verbosity),
 		OPT_BOOL(0, "progress", &opt.progress,
 			    N_("force cloning progress")),
 		OPT_BOOL(0, "require-init", &opt.require_init,
@@ -2637,7 +2638,7 @@  static int module_update(int argc, const char **argv, const char *prefix)
 	};
 
 	const char *const git_submodule_helper_usage[] = {
-		N_("git submodule [--quiet] update"
+		N_("git submodule [--quiet] update [-v | --verbose]"
 		" [--init [--filter=<filter-spec>]] [--remote]"
 		" [-N|--no-fetch] [-f|--force]"
 		" [--checkout|--merge|--rebase]"
@@ -2656,6 +2657,9 @@  static int module_update(int argc, const char **argv, const char *prefix)
 	if (opt.require_init)
 		opt.init = 1;
 
+	if (verbosity < 0)
+		opt.quiet = 1;
+
 	if (filter_options.choice && !opt.init) {
 		usage_with_options(git_submodule_helper_usage,
 				   module_update_options);