From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Glen Choo <chooglen@google.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
Atharva Raykar <raykar.ath@gmail.com>,
Christian Couder <christian.couder@gmail.com>,
Emily Shaffer <emilyshaffer@google.com>,
Jonathan Nieder <jrn@google.com>,
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>,
pc44800@gmail.com, Shourya Shukla <periperidip@gmail.com>
Subject: Re: [PATCH v5 9/9] submodule: move core cmd_update() logic to C
Date: Thu, 03 Feb 2022 03:26:28 +0100 [thread overview]
Message-ID: <220203.865ypw7jw6.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <kl6l4k5g246p.fsf@chooglen-macbookpro.roam.corp.google.com>
On Wed, Feb 02 2022, Glen Choo wrote:
> - Junio pointed out that this conflicts with
> es/superproject-aware-submodules [2]. I'm not sure which should be
> based on which. If this does end up being based on
> es/superproject-aware-submodules, it would probably be easier to
> rebase as a series of smaller patches. Atharva noted that the
> conflicts are mild though, so maybe it's not so bad.
I think it makes sense to get this series through first, i.e. the
(supposedly) no-behavior-changing one, and then one that introduces new
submodule behavior.
Particularly because for es/superproject-aware-submodules the main
selling point is a performance improvement, which as I noted in the
review for it I've been unable to observe once the C<->sh layer goes
away.
I'm not saying it's not there, just that I don't think it's been shown
so far, IIRC there was some reference to some Google-internal network FS
that might or might not be helped by it...
> - Besides making sure that the sh -> c is faithful, a thorough review
> should hopefully catch unintentional mistakes. The size of this patch
> makes such mistakes difficult to spot. For instance, here's something
> I spotted only after trying to split the patch myself..
>
> > +static int module_update(int argc, const char **argv, const char *prefix)
> > +{
> > + const char *update = NULL;
> > + struct pathspec pathspec;
> > + struct update_data opt = UPDATE_DATA_INIT;
> > +
> > + struct option module_update_clone_options[] = {
> [...]
> > + };
> > +
> > + const char *const git_submodule_helper_usage[] = {
> > + N_("git submodule--helper update-clone [--prefix=<path>] [<path>...]"),
> > + NULL
> > + };
> > +
> > + update_clone_config_from_gitmodules(&opt.max_jobs);
> > + git_config(git_update_clone_config, &opt.max_jobs);
>
> Notice that we copy-pasted the option parsing from update-clone into
> module_update() but forgot to update the names.
>
> My ideal patch organization would be something like:
>
> - wrap some existing command in "git submodule--helper update" (probably
> run-update-procedure)
> - absorb the surrounding sh code into "git submodule--helper
> update" one command at-a-time i.e. deprecating and removing the
> commands one at a time - instead of deprecating and removing them all
> at once (like this patch), or deprecating all at once and removing
> them one at a time (like v1).
I do think atomic changes that don't leave dead code for removal later
are easier to read & reason about, whatever else is reorganized.
I.e. not to have something where we replace all the running code, and
then remove already-unused code later.
On that topic, I noticed this series could/should have [1] fixed up into
it.
> - If you think this alternative organization would be helpful for you
> too, I will attempt it. This will take a while, but by the end you and
> I will have effectively reviewed all of the code, so it should be easy
> to finish up the review.
I think it might, but I really don't know. We'll just have to see, so if
you want to take a stab at it that would be great.
Maybe it's a good way forward. E.g. as af first small step we could turn:
while read -r quickabort sha1 just_cloned sm_path
[...]
die_if_unmatched "$quickabort" "$sha1"
into version where we fold that die_if_unmatched() logic into the C
code, and then ensure-core-worktree etc.
> - Otherwise e.g. maybe this is a huge waste of time, or you're already
> really confident in the correctness of the sh -> c when you reviewed
> the original patch, etc, I'll just review this patch as-is. I'd
> appreciate any tips and tricks that might help :)
I'm not really confident in it.
I've read it, tested it as well as I could manage etc. but it's still a
very large change.
1.
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index b93f39288ce..756c2a67c72 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -286,13 +286,6 @@ get_author_ident_from_commit () {
parse_ident_from_commit author AUTHOR
}
-# Clear repo-local GIT_* environment variables. Useful when switching to
-# another repository (e.g. when entering a submodule). See also the env
-# list in git_connect()
-clear_local_git_env() {
- unset $(git rev-parse --local-env-vars)
-}
-
# Generate a virtual base file for a two-file merge. Uses git apply to
# remove lines from $1 that are not in $2, leaving only common lines.
create_virtual_base() {
diff --git a/git-submodule.sh b/git-submodule.sh
index bcd8b92aabd..6c91b9e2403 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -50,30 +50,11 @@ single_branch=
jobs=
recommend_shallow=
-die_if_unmatched ()
-{
- if test "$1" = "#unmatched"
- then
- exit ${2:-1}
- fi
-}
-
isnumber()
{
n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
}
-# Sanitize the local git environment for use within a submodule. We
-# can't simply use clear_local_git_env since we want to preserve some
-# of the settings from GIT_CONFIG_PARAMETERS.
-sanitize_submodule_env()
-{
- save_config=$GIT_CONFIG_PARAMETERS
- clear_local_git_env
- GIT_CONFIG_PARAMETERS=$save_config
- export GIT_CONFIG_PARAMETERS
-}
-
#
# Add a new submodule to the working tree, .gitmodules and the index
#
next prev parent reply other threads:[~2022-02-03 2:40 UTC|newest]
Thread overview: 142+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 11:59 [PATCH 00/13] submodule: convert the rest of 'update' to C Atharva Raykar
2021-09-07 11:59 ` [PATCH 01/13] submodule--helper: split up ensure_core_worktree() Atharva Raykar
2021-09-07 11:59 ` [PATCH 02/13] submodule--helper: get remote names from any repository Atharva Raykar
2021-09-07 12:37 ` Ævar Arnfjörð Bjarmason
2021-09-07 13:33 ` Atharva Raykar
2021-09-07 11:59 ` [PATCH 03/13] submodule--helper: introduce get_default_remote_submodule() Atharva Raykar
2021-09-07 11:59 ` [PATCH 04/13] submodule--helper: rename helpers for update-clone Atharva Raykar
2021-09-07 11:59 ` [PATCH 05/13] submodule--helper: refactor get_submodule_displaypath() Atharva Raykar
2021-09-07 11:59 ` [PATCH 06/13] submodule: move core cmd_update() logic to C Atharva Raykar
2021-09-07 12:40 ` Ævar Arnfjörð Bjarmason
2021-09-07 11:59 ` [PATCH 07/13] submodule: remove fetch_in_submodule shell function Atharva Raykar
2021-09-07 12:44 ` Ævar Arnfjörð Bjarmason
2021-09-07 11:59 ` [PATCH 08/13] submodule--helper: remove update-clone subcommand Atharva Raykar
2021-09-07 12:46 ` Ævar Arnfjörð Bjarmason
2021-09-07 11:59 ` [PATCH 09/13] submodule--helper: remove update-module-mode subcommand Atharva Raykar
2021-09-07 12:49 ` Ævar Arnfjörð Bjarmason
2021-09-07 13:50 ` Atharva Raykar
2021-09-07 11:59 ` [PATCH 10/13] submodule--helper: remove shell interface to ensure_core_worktree() Atharva Raykar
2021-09-07 11:59 ` [PATCH 11/13] submodule--helper: remove print-default-remote subcommand Atharva Raykar
2021-09-07 11:59 ` [PATCH 12/13] submodule--helper: remove relative-path subcommand Atharva Raykar
2021-09-07 11:59 ` [PATCH 13/13] submodule--helper: remove run-update-procedure subcommand Atharva Raykar
2021-09-07 12:34 ` [PATCH 00/13] submodule: convert the rest of 'update' to C Ævar Arnfjörð Bjarmason
2021-09-07 12:53 ` Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 0/8] " Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 1/8] submodule--helper: split up ensure_core_worktree() Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 2/8] submodule--helper: get remote names from any repository Atharva Raykar
2021-09-20 16:52 ` Junio C Hamano
2021-10-03 13:22 ` Atharva Raykar
2021-09-20 21:28 ` Junio C Hamano
2021-09-21 16:33 ` Jonathan Tan
2021-09-16 10:32 ` [PATCH v2 3/8] submodule--helper: rename helpers for update-clone Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 4/8] submodule--helper: refactor get_submodule_displaypath() Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 5/8] submodule: move core cmd_update() logic to C Atharva Raykar
2021-09-20 17:13 ` Junio C Hamano
2021-10-03 10:38 ` Atharva Raykar
2021-09-20 19:58 ` Junio C Hamano
2021-09-20 21:28 ` Junio C Hamano
2021-09-16 10:32 ` [PATCH v2 6/8] submodule--helper: remove update-clone subcommand Atharva Raykar
2021-09-16 10:32 ` [PATCH v2 7/8] submodule--helper: remove unused helpers Atharva Raykar
2021-09-20 17:19 ` Junio C Hamano
2021-09-16 10:32 ` [PATCH v2 8/8] submodule--helper: rename helper functions Atharva Raykar
2021-09-20 17:19 ` Junio C Hamano
2021-10-13 5:17 ` [PATCH v3 0/9] submodule: convert the rest of 'update' to C Atharva Raykar
2021-10-13 5:17 ` [PATCH v3 1/9] submodule--helper: split up ensure_core_worktree() Atharva Raykar
2021-10-13 5:17 ` [PATCH v3 2/9] submodule--helper: get remote names from any repository Atharva Raykar
2021-10-13 5:17 ` [PATCH v3 3/9] submodule--helper: rename helpers for update-clone Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 4/9] submodule--helper: refactor get_submodule_displaypath() Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 5/9] submodule--helper: allow setting superprefix for init_submodule() Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 6/9] submodule--helper: run update using child process struct Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 7/9] submodule: move core cmd_update() logic to C Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 8/9] submodule--helper: remove unused helpers Atharva Raykar
2021-10-13 5:18 ` [PATCH v3 9/9] submodule--helper: rename helper functions Atharva Raykar
2021-10-14 0:05 ` [PATCH v3 0/9] submodule: convert the rest of 'update' to C Junio C Hamano
2021-10-14 20:46 ` Emily Shaffer
2021-12-03 19:00 ` Junio C Hamano
2021-12-03 20:15 ` Ævar Arnfjörð Bjarmason
2021-12-04 10:38 ` Atharva Raykar
2022-01-27 16:22 ` [PATCH v4 0/7] " Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 1/7] submodule--helper: get remote names from any repository Ævar Arnfjörð Bjarmason
2022-01-27 18:45 ` Glen Choo
2022-01-27 16:22 ` [PATCH v4 2/7] submodule--helper: refactor get_submodule_displaypath() Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 3/7] submodule--helper: allow setting superprefix for init_submodule() Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 4/7] submodule--helper: run update using child process struct Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 5/7] builtin/submodule--helper.c: reformat designated initializers Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 6/7] builtin/submodule--helper.c: rename "suc" variable to "opt" Ævar Arnfjörð Bjarmason
2022-01-27 16:22 ` [PATCH v4 7/7] submodule: move core cmd_update() logic to C Ævar Arnfjörð Bjarmason
2022-01-27 21:55 ` Glen Choo
2022-01-28 12:56 ` [PATCH v5 0/9] submodule: convert the rest of 'update' " Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 1/9] submodule--helper: get remote names from any repository Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 2/9] submodule--helper: refactor get_submodule_displaypath() Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 3/9] submodule--helper: allow setting superprefix for init_submodule() Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 4/9] submodule--helper: run update using child process struct Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 5/9] builtin/submodule--helper.c: reformat designated initializers Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 6/9] builtin/submodule--helper.c: rename option variables to "opt" Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 7/9] submodule--helper: don't use bitfield indirection for parse_options() Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 8/9] submodule tests: test for init and update failure output Ævar Arnfjörð Bjarmason
2022-01-28 12:56 ` [PATCH v5 9/9] submodule: move core cmd_update() logic to C Ævar Arnfjörð Bjarmason
2022-02-03 0:18 ` Glen Choo
2022-02-03 2:26 ` Ævar Arnfjörð Bjarmason [this message]
2022-02-03 8:15 ` Ævar Arnfjörð Bjarmason
2022-02-03 17:35 ` Glen Choo
2022-02-08 8:39 ` [PATCH v6 00/16] submodule: convert the rest of 'update' " Glen Choo
2022-02-08 8:39 ` [PATCH v6 01/16] submodule--helper: get remote names from any repository Glen Choo
2022-02-08 8:39 ` [PATCH v6 02/16] submodule--helper: refactor get_submodule_displaypath() Glen Choo
2022-02-08 8:39 ` [PATCH v6 03/16] submodule--helper: allow setting superprefix for init_submodule() Glen Choo
2022-02-08 8:39 ` [PATCH v6 04/16] submodule--helper: run update using child process struct Glen Choo
2022-02-08 8:39 ` [PATCH v6 05/16] builtin/submodule--helper.c: reformat designated initializers Glen Choo
2022-02-08 8:39 ` [PATCH v6 06/16] builtin/submodule--helper.c: rename option variables to "opt" Glen Choo
2022-02-08 8:39 ` [PATCH v6 07/16] submodule--helper: don't use bitfield indirection for parse_options() Glen Choo
2022-02-08 8:39 ` [PATCH v6 08/16] submodule tests: test for init and update failure output Glen Choo
2022-02-08 8:39 ` [PATCH v6 09/16] submodule--helper: remove update-module-mode Glen Choo
2022-02-08 8:39 ` [PATCH v6 10/16] submodule--helper: reorganize code for sh to C conversion Glen Choo
2022-02-08 8:39 ` [PATCH v6 11/16] submodule--helper run-update-procedure: remove --suboid Glen Choo
2022-02-08 8:39 ` [PATCH v6 12/16] submodule--helper run-update-procedure: learn --remote Glen Choo
2022-02-08 8:39 ` [PATCH v6 13/16] submodule--helper: remove ensure-core-worktree Glen Choo
2022-02-08 8:39 ` [PATCH v6 14/16] submodule--helper update-clone: learn --init Glen Choo
2022-02-08 8:39 ` [PATCH v6 15/16] submodule--helper: move functions around Glen Choo
2022-02-08 8:39 ` [PATCH v6 16/16] submodule: move core cmd_update() logic to C Glen Choo
2022-02-10 9:28 ` [PATCH v7 00/20] submodule: convert the rest of 'update' " Glen Choo
2022-02-10 9:28 ` [PATCH v7 01/20] submodule--helper: get remote names from any repository Glen Choo
2022-02-10 9:28 ` [PATCH v7 02/20] submodule--helper: refactor get_submodule_displaypath() Glen Choo
2022-02-12 14:24 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 03/20] submodule--helper: allow setting superprefix for init_submodule() Glen Choo
2022-02-12 14:30 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 04/20] submodule--helper: run update using child process struct Glen Choo
2022-02-12 14:33 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 05/20] builtin/submodule--helper.c: reformat designated initializers Glen Choo
2022-02-10 9:28 ` [PATCH v7 06/20] builtin/submodule--helper.c: rename option variables to "opt" Glen Choo
2022-02-10 9:28 ` [PATCH v7 07/20] submodule--helper: don't use bitfield indirection for parse_options() Glen Choo
2022-02-10 9:28 ` [PATCH v7 08/20] submodule tests: test for init and update failure output Glen Choo
2022-02-10 9:28 ` [PATCH v7 09/20] submodule--helper: remove update-module-mode Glen Choo
2022-02-12 14:35 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 10/20] submodule--helper: reorganize code for sh to C conversion Glen Choo
2022-02-10 9:28 ` [PATCH v7 11/20] submodule--helper run-update-procedure: remove --suboid Glen Choo
2022-02-10 9:28 ` [PATCH v7 12/20] submodule--helper run-update-procedure: learn --remote Glen Choo
2022-02-12 14:38 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 13/20] submodule--helper: remove ensure-core-worktree Glen Choo
2022-02-10 9:28 ` [PATCH v7 14/20] submodule--helper update-clone: learn --init Glen Choo
2022-02-10 9:28 ` [PATCH v7 15/20] submodule--helper: move functions around Glen Choo
2022-02-12 14:41 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 16/20] submodule--helper: reduce logic in run_update_procedure() Glen Choo
2022-02-10 9:28 ` [PATCH v7 17/20] submodule: move core cmd_update() logic to C Glen Choo
2022-02-10 9:34 ` Glen Choo
2022-02-10 9:28 ` [PATCH v7 18/20] fixup! submodule--helper run-update-procedure: remove --suboid Glen Choo
2022-02-12 14:41 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 19/20] fixup! submodule--helper run-update-procedure: learn --remote Glen Choo
2022-02-12 14:43 ` Ævar Arnfjörð Bjarmason
2022-02-10 9:28 ` [PATCH v7 20/20] fixup! submodule: move core cmd_update() logic to C Glen Choo
2022-02-12 14:45 ` [PATCH v7 00/20] submodule: convert the rest of 'update' " Ævar Arnfjörð Bjarmason
2022-02-17 5:44 ` Glen Choo
2022-02-17 9:17 ` Ævar Arnfjörð Bjarmason
2022-02-17 16:14 ` Glen Choo
2022-02-13 5:54 ` Junio C Hamano
2022-02-13 6:14 ` Junio C Hamano
2022-02-14 16:37 ` Glen Choo
2022-02-14 17:19 ` Ævar Arnfjörð Bjarmason
2022-02-15 9:34 ` Glen Choo
2022-02-14 17:34 ` Junio C Hamano
2022-02-15 9:31 ` Glen Choo
2022-02-15 9:47 ` Glen Choo
2021-10-14 21:50 ` [PATCH 00/13] " Glen Choo
2021-10-15 9:13 ` Atharva Raykar
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=220203.865ypw7jw6.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=chooglen@google.com \
--cc=christian.couder@gmail.com \
--cc=emilyshaffer@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrn@google.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=pc44800@gmail.com \
--cc=periperidip@gmail.com \
--cc=raykar.ath@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).