{"thread":{"id":"65952","subject":"[PATCH] submodule--helper: accept '-i' shorthand for update --init","startedAt":"2026-07-08T03:34:04Z","lastAt":"2026-07-08T20:12:16Z","messageCount":2,"participants":["Dominique Martinet","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"547434","messageId":"20260708-submodule-init-v1-1-719456077262@atmark-techno.com","threadId":"65952","inReplyTo":null,"subject":"[PATCH] submodule--helper: accept '-i' shorthand for update --init","fromName":"Dominique Martinet","fromEmail":"dominique.martinet@atmark-techno.com","sentAt":"2026-07-08T03:33:42Z","receivedAt":"2026-07-08T03:34:04Z","isPatch":true,"body":"commit 3ad0ba722744 (\"git-submodule.sh: improve variables readability\")\nmade `git submodules update -i` pass `-i` as is to submodule--helper,\nbut it fails with `error: unknown switch `i'` because the helper does\nnot accept the short option.\n\nAll other short options supported by git-submodule.sh are properly\nhandle in the helper, so also add the alias for --init\n\nFixes: 3ad0ba722744 (\"git-submodule.sh: improve variables readability\")\nSigned-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>\n---\nThis apparently can't be used much because it's been broken since v2.49,\nand it's not in the help, but I guess we might as well fix this since it\nused to work?\n\nThanks!\n---\n builtin/submodule--helper.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c\nindex 1cc82a134db2..3ec8bf50532e 100644\n--- a/builtin/submodule--helper.c\n+++ b/builtin/submodule--helper.c\n@@ -2990,7 +2990,7 @@ static int module_update(int argc, const char **argv, const char *prefix,\n \tstruct option module_update_options[] = {\n \t\tOPT__SUPER_PREFIX(&opt.super_prefix),\n \t\tOPT__FORCE(&opt.force, N_(\"force checkout updates\"), 0),\n-\t\tOPT_BOOL(0, \"init\", &opt.init,\n+\t\tOPT_BOOL('i', \"init\", &opt.init,\n \t\t\t N_(\"initialize uninitialized submodules before update\")),\n \t\tOPT_BOOL(0, \"remote\", &opt.remote,\n \t\t\t N_(\"use SHA-1 of submodule's remote tracking branch\")),\n\n---\nbase-commit: 11320dd2066f2139870e36987240abc981cb493c\n\n\n"},{"id":"547531","messageId":"xmqq8q7ltf51.fsf@gitster.g","threadId":"65952","inReplyTo":"20260708-submodule-init-v1-1-719456077262@atmark-techno.com","subject":"Re: [PATCH] submodule--helper: accept '-i' shorthand for update --init","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-07-08T20:12:10Z","receivedAt":"2026-07-08T20:12:16Z","isPatch":true,"body":"Dominique Martinet <dominique.martinet@atmark-techno.com> writes:\n\n> commit 3ad0ba722744 (\"git-submodule.sh: improve variables readability\")\n> made `git submodules update -i` pass `-i` as is to submodule--helper,\n> but it fails with `error: unknown switch `i'` because the helper does\n> not accept the short option.\n>\n> All other short options supported by git-submodule.sh are properly\n> handle in the helper, so also add the alias for --init\n>\n> Fixes: 3ad0ba722744 (\"git-submodule.sh: improve variables readability\")\n> Signed-off-by: Dominique Martinet <dominique.martinet@atmark-techno.com>\n> ---\n> This apparently can't be used much because it's been broken since v2.49,\n> and it's not in the help, but I guess we might as well fix this since it\n> used to work?\n\n3ad0ba7227 (git-submodule.sh: improve variables readability,\n2024-12-11) is v2.49.0-rc0~107^2~1 and indeed we broke it and nobody\nhas noticed and reported since then.  An obvious alternative would\nbe to give a single-liner:\n\ndiff --git c/git-submodule.sh w/git-submodule.sh\nindex 2999b31fad..9a989edb20 100755\n--- c/git-submodule.sh\n+++ w/git-submodule.sh\n@@ -285,7 +285,7 @@ cmd_update()\n \t\t\tprogress=$1\n \t\t\t;;\n \t\t-i|--init)\n-\t\t\tinit=$1\n+\t\t\tinit=--init\n \t\t\t;;\n \t\t--require-init)\n \t\t\trequire_init=$1\n\n\nbut since anybody should be directly running \"git submodule--helper\"\nby hand, I think it is perfectly fine to teach it a short-option\nlike your patch does.\n\nWill apply.  Thanks.\n"}]}