Git development
 help / color / mirror / Atom feed
From: Dominique Martinet <dominique.martinet@atmark-techno.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Glen Choo" <glencbz@gmail.com>,
	"Atharva Raykar" <raykar.ath@gmail.com>
Cc: Roy Eldar <royeldar0@gmail.com>,
	git@vger.kernel.org,
	 Dominique Martinet <dominique.martinet@atmark-techno.com>
Subject: [PATCH] submodule--helper: accept '-i' shorthand for update --init
Date: Wed, 08 Jul 2026 03:33:42 +0000	[thread overview]
Message-ID: <20260708-submodule-init-v1-1-719456077262@atmark-techno.com> (raw)

commit 3ad0ba722744 ("git-submodule.sh: improve variables readability")
made `git submodules update -i` pass `-i` as is to submodule--helper,
but it fails with `error: unknown switch `i'` because the helper does
not accept the short option.

All other short options supported by git-submodule.sh are properly
handle in the helper, so also add the alias for --init

Fixes: 3ad0ba722744 ("git-submodule.sh: improve variables readability")
Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
---
This apparently can't be used much because it's been broken since v2.49,
and it's not in the help, but I guess we might as well fix this since it
used to work?

Thanks!
---
 builtin/submodule--helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 1cc82a134db2..3ec8bf50532e 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2990,7 +2990,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
 	struct option module_update_options[] = {
 		OPT__SUPER_PREFIX(&opt.super_prefix),
 		OPT__FORCE(&opt.force, N_("force checkout updates"), 0),
-		OPT_BOOL(0, "init", &opt.init,
+		OPT_BOOL('i', "init", &opt.init,
 			 N_("initialize uninitialized submodules before update")),
 		OPT_BOOL(0, "remote", &opt.remote,
 			 N_("use SHA-1 of submodule's remote tracking branch")),

---
base-commit: 11320dd2066f2139870e36987240abc981cb493c



             reply	other threads:[~2026-07-08  3:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  3:33 Dominique Martinet [this message]
2026-07-08 20:12 ` [PATCH] submodule--helper: accept '-i' shorthand for update --init Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260708-submodule-init-v1-1-719456077262@atmark-techno.com \
    --to=dominique.martinet@atmark-techno.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=glencbz@gmail.com \
    --cc=raykar.ath@gmail.com \
    --cc=royeldar0@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox