From: Glen Choo <chooglen@google.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jonas Bernoulli" <jonas@bernoul.li>, "Jeff King" <peff@peff.net>,
"Emily Shaffer" <emilyshaffer@google.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: Re: [PATCH 05/10] git-submodule.sh: dispatch "update" to helper
Date: Thu, 20 Oct 2022 14:50:45 -0700 [thread overview]
Message-ID: <kl6lv8oexiyy.fsf@chooglen-macbookpro.roam.corp.google.com> (raw)
In-Reply-To: <patch-05.10-7d9c13eb637-20221017T115544Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> As noted in a preceding commit the only behavior change here should be
> the desirable change of better "-h" output, and that this
> implementation understands the "--verbose" synonym for "-v". Let's
> update the documentation to reflect the new "--verbose" synonym.
Hm, I didn't see this change in the patch.
> - git ${wt_prefix:+-C "$wt_prefix"} submodule--helper update \
> - ${quiet:+--quiet} \
> - ${force:+--force} \
> - ${progress:+"--progress"} \
> - ${remote:+--remote} \
> - ${recursive:+--recursive} \
> - ${init:+--init} \
> - ${nofetch:+--no-fetch} \
> - ${wt_prefix:+--prefix "$wt_prefix"} \
> - ${rebase:+--rebase} \
> - ${merge:+--merge} \
> - ${checkout:+--checkout} \
> - ${reference:+"$reference"} \
> - ${dissociate:+"--dissociate"} \
> - ${depth:+"$depth"} \
> - ${require_init:+--require-init} \
> - ${dissociate:+"--dissociate"} \
> - $single_branch \
> - $recommend_shallow \
> - $jobs \
> - $filter \
> - -- \
> - "$@"
> -}
[...]
> -
> -# This loop parses the command line arguments to find the
> -# subcommand name to dispatch. Parsing of the subcommand specific
> -# options are primarily done by the subcommand implementations.
> -# Subcommand specific options such as --branch and --cached are
> -# parsed here as well, for backward compatibility.
This comment still seems relevant as of this patch.
> while test $# != 0 && test -z "$command"
> do
> @@ -233,7 +80,8 @@ absorbgitdirs)
> git submodule--helper "$command" --prefix "$wt_prefix" "$@"
> ;;
> update)
> - cmd_update "$@"
> + git ${wt_prefix:+-C "$wt_prefix"} submodule--helper "$command" \
> + ${quiet:+--quiet} ${wt_prefix:+--prefix "$wt_prefix"} "$@"
> ;;
> add | foreach | init | deinit | set-branch | set-url | status | summary | sync)
> git ${wt_prefix:+-C "$wt_prefix"} submodule--helper "$command" \
I haven't read ahead to see whether this was fixed, but it looks like
the reason we couldn't combine "update" into this arms is that "update"
consumes "wt_prefix" twice.
There's no good reason to have "--prefix" at all actually. "git
submodule update" used to use that instead of -C, and we could have
removed it once we passed -C in 29a5e9e1ff (submodule--helper
update-clone: learn --init, 2022-03-04). That simplification got lost in
the big shell -> C conversion, but we could do it quite easily right
now, e.g.
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index d11e100301..a4f59e91c5 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -2636,9 +2636,6 @@ static int module_update(int argc, const char **argv, const char *prefix)
N_("traverse submodules recursively")),
OPT_BOOL('N', "no-fetch", &opt.nofetch,
N_("don't fetch new objects from the remote site")),
- OPT_STRING(0, "prefix", &opt.prefix,
- N_("path"),
- N_("path into the working tree")),
OPT_SET_INT(0, "checkout", &opt.update_default,
N_("use the 'checkout' update strategy (default)"),
SM_UPDATE_CHECKOUT),
@@ -2694,6 +2691,7 @@ static int module_update(int argc, const char **argv, const char *prefix)
}
opt.filter_options = &filter_options;
+ opt.prefix = prefix;
if (opt.update_default)
opt.update_strategy.type = opt.update_default;
diff --git a/git-submodule.sh b/git-submodule.sh
index ac2f95c128..2787aaa60c 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -79,11 +79,8 @@ case "$command" in
absorbgitdirs)
git submodule--helper "$command" --prefix "$wt_prefix" "$@"
;;
-update)
- git ${wt_prefix:+-C "$wt_prefix"} submodule--helper "$command" \
- ${quiet:+--quiet} ${wt_prefix:+--prefix "$wt_prefix"} "$@"
- ;;
-add | foreach | init | deinit | set-branch | set-url | status | summary | sync)
+
+add | foreach | init | deinit | set-branch | set-url | status | summary | sync | update)
git ${wt_prefix:+-C "$wt_prefix"} submodule--helper "$command" \
${quiet:+--quiet} ${cached:+--cached} "$@"
;;
> --
> 2.38.0.1091.gf9d18265e59
next prev parent reply other threads:[~2022-10-20 21:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-17 12:09 [PATCH 00/10] submodule: make it a built-in, remove git-submodule.sh Ævar Arnfjörð Bjarmason
2022-10-17 12:09 ` [PATCH 01/10] git-submodule.sh: create a "case" dispatch statement Ævar Arnfjörð Bjarmason
2022-10-17 12:09 ` [PATCH 02/10] git-submodule.sh: dispatch "sync" to helper Ævar Arnfjörð Bjarmason
2022-10-20 20:42 ` Glen Choo
2022-10-17 12:09 ` [PATCH 03/10] git-submodule.sh: dispatch directly " Ævar Arnfjörð Bjarmason
2022-10-17 12:09 ` [PATCH 04/10] git-submodule.sh: dispatch "foreach" " Ævar Arnfjörð Bjarmason
2022-10-20 21:14 ` Glen Choo
2022-10-17 12:09 ` [PATCH 05/10] git-submodule.sh: dispatch "update" " Ævar Arnfjörð Bjarmason
2022-10-20 21:50 ` Glen Choo [this message]
2022-10-17 12:09 ` [PATCH 06/10] git-submodule.sh: don't support top-level "--cached" Ævar Arnfjörð Bjarmason
2022-10-20 22:14 ` Glen Choo
2022-10-17 12:09 ` [PATCH 07/10] submodule: make it a built-in, remove git-submodule.sh Ævar Arnfjörð Bjarmason
2022-10-20 22:49 ` Glen Choo
2022-10-17 12:09 ` [PATCH 08/10] submodule: support "--" with no other arguments Ævar Arnfjörð Bjarmason
2022-10-17 12:09 ` [PATCH 09/10] submodule: support sub-command-less "--recursive" option Ævar Arnfjörð Bjarmason
2022-10-20 23:05 ` Glen Choo
2022-10-17 12:09 ` [PATCH 10/10] submodule: don't use a subprocess to invoke "submodule--helper" Ævar Arnfjörð Bjarmason
2022-10-20 23:18 ` Glen Choo
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=kl6lv8oexiyy.fsf@chooglen-macbookpro.roam.corp.google.com \
--to=chooglen@google.com \
--cc=avarab@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jonas@bernoul.li \
--cc=peff@peff.net \
/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;
as well as URLs for NNTP newsgroup(s).