Re: [PATCH v4 03/10] submodule sync: skip work for inactive submodules
- From
- Brandon Williams <bmwill@google.com>
- Date
- Mar 16, 2017, 23:26 UTC
- Message-ID
- <20170316232637.GB168812@google.com>
- In-Reply-To
- <CAGZ79kaP9ob+qvso=pV=PPaB5guaW18w297xA+bfDFASV0zibg@mail.gmail.com>
On 03/16, Stefan Beller wrote:
Show 16 quoted lines
> On Thu, Mar 16, 2017 at 3:29 PM, Brandon Williams <bmwill@google.com> wrote: > > Sync does some work determining what URLs should be used for a submodule > > but then throws this work away if the submodule isn't active. Instead > > perform the activity check earlier and skip inactive submodule in order > > to avoid doing unnecessary work. > > > > Signed-off-by: Brandon Williams <bmwill@google.com> > > --- > > > + # skip inactive submodules > > + if ! git config "submodule.$name.url" >/dev/null 2>/dev/null > > As a stand alone patch, this would look good to me. > But with the goal of this patch series in mind (which is to add > more options to enable a submodules "active" state), this > should rather be "submodule--helper is-active" here?
Junio mentioned do this as a preparatory step to make it easier to review. The next patch changes that to use 'is-active' instead of the URL.
Show 8 quoted lines
> > > > + then > > + continue > > + fi > > + > > The changes below here are just de-dented, no behavioral change?
Yeah no behavioral change, just short circuiting earlier.
Show 37 quoted lines
> > > > > - if git config "submodule.$name.url" >/dev/null 2>/dev/null > > + displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix") > > + say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")" > > + git config submodule."$name".url "$super_config_url" > > + > > + if test -e "$sm_path"/.git > > then > > - displaypath=$(git submodule--helper relative-path "$prefix$sm_path" "$wt_prefix") > > - say "$(eval_gettext "Synchronizing submodule url for '\$displaypath'")" > > - git config submodule."$name".url "$super_config_url" > > + ( > > + sanitize_submodule_env > > + cd "$sm_path" > > + remote=$(get_default_remote) > > + git config remote."$remote".url "$sub_origin_url" > > > > - if test -e "$sm_path"/.git > > + if test -n "$recursive" > > then > > - ( > > - sanitize_submodule_env > > - cd "$sm_path" > > - remote=$(get_default_remote) > > - git config remote."$remote".url "$sub_origin_url" > > - > > - if test -n "$recursive" > > - then > > - prefix="$prefix$sm_path/" > > - eval cmd_sync > > - fi > > - ) > > + prefix="$prefix$sm_path/" > > + eval cmd_sync > > fi > > + )
-- Brandon Williams