git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
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>
Subject: Re: [PATCH v2 00/12] submodule: make "git submodule--helper" behave like "git submodule"
Date: Tue, 14 Jun 2022 01:31:10 +0200	[thread overview]
Message-ID: <220614.86pmjcyv4u.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <kl6lwndk5ffc.fsf@chooglen-macbookpro.roam.corp.google.com>


On Mon, Jun 13 2022, Glen Choo wrote:

> Thanks! I'm happy to see this happen regardless of whose patches we use
> :)

I didn't set out to keep "my side", but just to see if we could come up
with something non-RFC that could be queued/integrated sooner than
later, and removing dead code & the smallish changes to unify the
interfaces for a subsequent conversion seemed like it would be more
palatable.

Thus dropping 1-3/8 of yours, it's the "real" migration (or steps
towards it). Then your 4/8 was tangled up in that migration so I took my
smaller 12/20 over it.

I then took your 5/8, but combined with my 13/20 as discussed in the
CL. I.e. splitting up the external from internal interface change, which
we can do in two steps.

Your 6/8 is then taken over my 14-15/20, 7/8 is another thing I dropped
as the "real" migration to leave for later, and as discussed (see below)
your 8/8 is much smaller than the dead code removal we can do here in
2/12, i.e. we can drop --super-prefix, and a lot of yarn falls out once
we pull on that thread...

Most of the patches I dropped were my own :) I.e. the "actual
conversion" bits, and then I picked up e.g. the
s/absorb-git-dirs/absorbgitdirs/g etc., and other patches in my series
that unified the interfaces.

> Reading the cover letter, I think it probably makes sense for this to
> supersede gc/submodule-update. I haven't really looked at the changes
> yet though, but I will soon.

I hadn't noticed that Junio had picked your RFC patches up (I didn't
check, figuring since it was RFC they wouldn't be...).

Anyway, I'm fine with whatever gets us to the end goal most efficiently.

> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>>> Here's a way of breaking apart the work that makes sense to me:
>>>
>>> - Reuse the patches that prepare git-submodule.sh for the conversion,
>>>   particularly 1-7/20 (create a "case" dispatch statement and its
>>>   preceding patches).
>>> - Keep my series that prepares "update", since that's the most tedious
>>>   one to convert. If I don't dispatch to the "case" statement, I don't
>>>   think it will even conflict with the preparatory series.
>>>
>>>   Some of your patches make more sense than mine, and I'll incorporate
>>>   them as necessary :)
>>> - Dispatch subcommands using the "case" dispatch, including "update". We
>>>   might have to do this slowly if we want things to be easy to eyeball.
>>> - "git rm git-submodule.sh"!
>>
>> Hopefully there's no stepping on toes here, but I thought I'd send
>> this out now (I went back to the laptop) to avoid the duplicate work,
>> since I'd already attempted combining the two, and this is the result.
>
> Fortunately I hadn't resumed work on this yet, so it works out :)

Hope it helped :)

>> [...]
>> This is still in this series as 02/12. I think you've misunderstood
>> that code, it *is* invoking "git submodule--helper" with
>> "--super-prefix", but the option is passed as:
>>
>>     git --super-prefix <path> submodule--helper
>>
>> And not as:
>>
>>     git submodule--helper --super-prefix <path>
>>
>> This is thus handled by other code before builtin/submodule--helper.c,
>> and it doesn't need to handle it.
>>
>> But anyway, this is confusing, so I updated the commit message (seen
>> in the range-diff below)>
>
> Ah that's right, I forgot that we have to pass it to "git" directly.
> Thanks.
>
> I wonder why we ever needed this. 89c8626557 (submodule helper: support
> super prefix, 2016-12-08) doesn't really explain it, so it looks like
> I'll have to dig around the ML.

It was needed, but not after b3c5f5cb048 (submodule: move core
cmd_update() logic to C, 2022-03-15) as my 02/12 discusses.

As a quick test try to check out b3c5f5cb048 and apply this change:

    -#define SUPPORT_SUPER_PREFIX (1<<0)
    +#define SUPPORT_SUPER_PREFIX 0

You'll find that t7406-submodule-update.sh passes, but check out its
parent (which is a commit of yours) and it'll fail, as we'll then emit
output like:

    -Submodule path '../super': checked out 'e1c658656b91df52a4634fbffeaa739807ce3521'
    +Submodule path 'super': checked out 'e1c658656b91df52a4634fbffeaa739807ce3521'

So this is just one of the things that were overly complex in
git-submodule--helper because parts of it had to bridge the gap between
*.sh and *.c land, but once we moved more parts to C we ended up getting
that for free.

>>>>   submodule--helper: have --require-init imply --init
>>>>   submodule--helper: understand --checkout, --merge and --rebase
>>>>     synonyms
>>>>   git-submodule doc: document the -v" option to "update"
>>>>   submodule--helper: understand -v option for "update"
>>>>
>>>> not-so-easy prep for "cmd_update()"
>>>>
>>>>   git-submodule.sh: dispatch "update" to helper
>>>>
>>>> Full cmd_update() migration in one go.
>>>
>>> Yeah, and since it's not-so-easy, it probably makes sense to continue to
>>> keep my series around. I'll borrow some of these patches if that's ok :)
>>
>> The proposal in *this series* is to leave this aside for now, but
>> generally I wonder what part of it you find not-so-easy.
>>
>> Personally I find it much harder to carefully review the way you
>> proposed to do it, i.e. to "buffer up" options that we "don't handle",
>> but actually need to sort-of handle, as we'd still like to die if we
>> have unknown options.
>>
>> Particularly since shellscript quoting etc. is a pain with that sort
>> of thing, as it doesn't have any real list or key-value
>> datastructures.
>>
>> Whereas getting it to the point where we're clearly just passing
>> options as-is through beforehand, and then simply dropping the wrapper
>> is, I think, much easier to review. You only need to trust or check
>> that e.g. "git submodule--helper update" also supports a "--progress"
>> option or whatever, and/or that we've got coverage for it.
>
> Makes sense. I suppose we don't have to overthink the conversion because
> we will have to make the leap of faith to C at some point.

Anyway, that's something we can leave aside for now. I.e. maybe your way
of doing it is better, maybe mine is. That's for later.

For now what do you think about focusing on initial smaller changes to
get the two command-line interfaces as close to 1=1 as possible, and to
remove dead code etc.

I.e. to aim for small changes now to make reviewing the eventual *.sh
v.s. *.c code as easy as possible, as the CLI for "submodule" and
"submodule--helper" will behave the same at that point, there won't be
any dead code etc.

  reply	other threads:[~2022-06-13 23:59 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  0:26 [PATCH 0/8] [RFC] submodule update: parse all options in C Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 1/8] submodule update: remove intermediate parsing Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 2/8] submodule update: pass options containing "[no-]" Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 3/8] submodule update: pass options with stuck forms Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 4/8] submodule update: pass --require-init and --init Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 5/8] submodule--helper update: use one param per type Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 6/8] submodule update: remove -v, pass --quiet Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 7/8] submodule update: stop parsing options in .sh Glen Choo via GitGitGadget
2022-06-10  0:26 ` [PATCH 8/8] submodule update: remove never-used expansion Glen Choo via GitGitGadget
2022-06-10  2:01 ` [RFC PATCH 00/20] submodule: remove git-submodule.sh, create bare builtin/submodule.c Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 01/20] git-submodule.sh: remove unused sanitize_submodule_env() Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 02/20] git-submodule.sh: remove unused $prefix variable Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 03/20] git-submodule.sh: remove unused --super-prefix logic Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 04/20] git-submodule.sh: normalize parsing of "--branch" Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 05/20] git-submodule.sh: normalize parsing of --cached Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 06/20] submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 07/20] git-submodule.sh: create a "case" dispatch statement Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 08/20] submodule--helper: pretend to be "git submodule" in "-h" output Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 09/20] git-submodule.sh: dispatch "sync" to helper Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 10/20] git-submodule.sh: dispatch directly " Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 11/20] git-submodule.sh: dispatch "foreach" " Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 12/20] submodule--helper: have --require-init imply --init Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 13/20] submodule--helper: understand --checkout, --merge and --rebase synonyms Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 14/20] git-submodule doc: document the -v" option to "update" Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 15/20] submodule--helper: understand -v option for "update" Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 16/20] git-submodule.sh: dispatch "update" to helper Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 17/20] git-submodule.sh: use "$quiet", not "$GIT_QUIET" Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 18/20] git-submodule.sh: simplify parsing loop Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 19/20] submodule: make it a built-in, remove git-submodule.sh Ævar Arnfjörð Bjarmason
2022-06-10  2:01   ` [RFC PATCH 20/20] submodule: add a subprocess-less submodule.useBuiltin setting Ævar Arnfjörð Bjarmason
2022-06-13 19:07   ` [RFC PATCH 00/20] submodule: remove git-submodule.sh, create bare builtin/submodule.c Glen Choo
2022-06-13 22:38     ` [PATCH v2 00/12] submodule: make "git submodule--helper" behave like "git submodule" Ævar Arnfjörð Bjarmason
2022-06-13 22:38       ` [PATCH v2 01/12] git-submodule.sh: remove unused sanitize_submodule_env() Ævar Arnfjörð Bjarmason
2022-06-13 22:38       ` [PATCH v2 02/12] git-submodule.sh: remove unused $prefix var and --super-prefix Ævar Arnfjörð Bjarmason
2022-06-13 22:38       ` [PATCH v2 03/12] git-submodule.sh: make "$cached" variable a boolean Ævar Arnfjörð Bjarmason
2022-06-13 22:38       ` [PATCH v2 04/12] git-submodule.sh: remove unused top-level "--branch" argument Ævar Arnfjörð Bjarmason
2022-06-15  0:10         ` Glen Choo
2022-06-13 22:38       ` [PATCH v2 05/12] submodule--helper: have --require-init imply --init Ævar Arnfjörð Bjarmason
2022-06-15  0:19         ` Glen Choo
2022-06-13 22:38       ` [PATCH v2 06/12] submodule update: remove "-v" option Ævar Arnfjörð Bjarmason
2022-06-15  0:29         ` Glen Choo
2022-06-13 22:38       ` [PATCH v2 07/12] submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" Ævar Arnfjörð Bjarmason
2022-06-13 22:38       ` [PATCH v2 08/12] submodule--helper: report "submodule" as our name in "-h" output Ævar Arnfjörð Bjarmason
2022-06-15  3:34         ` Glen Choo
2022-06-15  4:01         ` Glen Choo
2022-06-15  9:42           ` Ævar Arnfjörð Bjarmason
2022-06-13 22:39       ` [PATCH v2 09/12] submodule--helper: understand --checkout, --merge and --rebase synonyms Ævar Arnfjörð Bjarmason
2022-06-13 22:39       ` [PATCH v2 10/12] submodule--helper: eliminate internal "--update" option Ævar Arnfjörð Bjarmason
2022-06-15 16:52         ` Glen Choo
2022-06-13 22:39       ` [PATCH v2 11/12] git-submodule.sh: use "$quiet", not "$GIT_QUIET" Ævar Arnfjörð Bjarmason
2022-06-13 22:39       ` [PATCH v2 12/12] git-sh-setup.sh: remove "say" function, change last users Ævar Arnfjörð Bjarmason
2022-06-15 16:58         ` Glen Choo
2022-06-13 23:09       ` [PATCH v2 00/12] submodule: make "git submodule--helper" behave like "git submodule" Glen Choo
2022-06-13 23:31         ` Ævar Arnfjörð Bjarmason [this message]
2022-06-15  0:00           ` Glen Choo
2022-06-15 18:42       ` Glen Choo
2022-06-22 14:27       ` [PATCH v3 " Ævar Arnfjörð Bjarmason
2022-06-22 14:27         ` [PATCH v3 01/12] git-submodule.sh: remove unused sanitize_submodule_env() Ævar Arnfjörð Bjarmason
2022-06-22 14:27         ` [PATCH v3 02/12] git-submodule.sh: remove unused $prefix var and --super-prefix Ævar Arnfjörð Bjarmason
2022-06-22 23:43           ` Glen Choo
2022-06-24 15:07             ` Ævar Arnfjörð Bjarmason
2022-06-24 16:48               ` Glen Choo
2022-06-22 14:27         ` [PATCH v3 03/12] git-submodule.sh: make the "$cached" variable a boolean Ævar Arnfjörð Bjarmason
2022-06-22 14:27         ` [PATCH v3 04/12] git-submodule.sh: remove unused top-level "--branch" argument Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 05/12] submodule--helper: have --require-init imply --init Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 06/12] submodule update: remove "-v" option Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 07/12] submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 08/12] submodule--helper: report "submodule" as our name in some "-h" output Ævar Arnfjörð Bjarmason
2022-06-22 18:28           ` Glen Choo
2022-06-22 14:28         ` [PATCH v3 09/12] submodule--helper: understand --checkout, --merge and --rebase synonyms Ævar Arnfjörð Bjarmason
2022-06-22 18:57           ` Glen Choo
2022-06-22 19:04             ` Glen Choo
2022-06-22 14:28         ` [PATCH v3 10/12] submodule--helper: eliminate internal "--update" option Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 11/12] git-submodule.sh: use "$quiet", not "$GIT_QUIET" Ævar Arnfjörð Bjarmason
2022-06-22 14:28         ` [PATCH v3 12/12] git-sh-setup.sh: remove "say" function, change last users Ævar Arnfjörð Bjarmason
2022-06-24  3:39         ` [PATCH v3 00/12] submodule: make "git submodule--helper" behave like "git submodule" Glen Choo
2022-06-28 10:05         ` [PATCH v4 " Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 01/12] git-submodule.sh: remove unused sanitize_submodule_env() Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 02/12] git-submodule.sh: remove unused $prefix variable Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 03/12] git-submodule.sh: make the "$cached" variable a boolean Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 04/12] git-submodule.sh: remove unused top-level "--branch" argument Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 05/12] submodule--helper: have --require-init imply --init Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 06/12] submodule update: remove "-v" option Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 07/12] submodule--helper: rename "absorb-git-dirs" to "absorbgitdirs" Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 08/12] submodule--helper: report "submodule" as our name in some "-h" output Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 09/12] submodule--helper: understand --checkout, --merge and --rebase synonyms Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 10/12] submodule--helper: eliminate internal "--update" option Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 11/12] git-submodule.sh: use "$quiet", not "$GIT_QUIET" Ævar Arnfjörð Bjarmason
2022-06-28 10:05           ` [PATCH v4 12/12] git-sh-setup.sh: remove "say" function, change last users Ævar Arnfjörð Bjarmason
2022-06-28 16:52           ` [PATCH v4 00/12] submodule: make "git submodule--helper" behave like "git submodule" 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

  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=220614.86pmjcyv4u.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=chooglen@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).