git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Re: Re: Relative submodule URLs

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Aug 26, 2014, 15:18 UTC
Message-ID
<CAHd499CC3XxE5X3OPobK9yNKqypCLP5pe1Q7cFyW_wWne6pnnQ@mail.gmail.com>
In-Reply-To
<20140826062847.GA12216@book.hvoigt.net>
On Tue, Aug 26, 2014 at 1:28 AM, Heiko Voigt <hvoigt@hvoigt.net> wrote:
Show 24 quoted lines
>> Hi Heiko,
>>
>> My last email response was in violation of your request to keep the
>> two topics separate, sorry about that. I started typing it this
>> weekend and completed the draft this morning, without having read this
>> response from you first.
>
> Thats fine, no problem.
>
>> Here is what I think would make the feature most usable. I think you
>> went over some of these ideas but I just want to clarify, to make sure
>> we're on the same page. Please correct me as needed.
>>
>> 1. Running `git submodule update --with-remote <name>` shall fail the
>> command unconditionally.
>
> I am not sure but I think you mean
>
>         git submodule update --with-remote=<name>
>
> With the equals sign, without it you would name the submodule paths to
> update. No I think that should just add the remote <name> to all
> submodules that would be updated and do the normal update operation on
> them (with the new remote of course).

I'm not sure about Linux but at least with msysgit on Windows, typing a two-dash option (such as --with-remote) forces command line evaluation to use the next placement parameter as the parameter for it. I've seen this work the same way with argparse in python too. In my experience, command line has worked that way, I'm not sure if that is by design or not though. I never use equal signs with git commands, never had a problem for some reason.

For example:
git rebase --onto release/1.0 head~3 head
The `--onto` option knows to use `release/1.0` as its parameter.
Show 6 quoted lines
>> 2. Using the `--with-remote` option on submodule `update` or `sync`
>> will fail if it detects absolute submodule URLs in .gitmodule
>
> Yes, almost. Since you can have a mixture I suggest to only fail if the
> submodules that would be processed have an absolute url in them. If
> processed submodules are all relative it can go ahead.
For example if it processes 3 submodules in the following order:
1. relative
2. absolute
3. relative

Should it fail before or after processing the 3rd relative submodule? I was thinking it would fail while trying to sync/update the 2nd one (which is absolute) and stop before processing the 3rd.

Show 7 quoted lines
>> 3. Running `git submodule update --init --with-remote <name>` shall
>> fail the command ONLY if a submodule is being processed that is NOT
>> also being initialized.
>
> No since the --init flag just tells update to initialize submodules
> on-demand. It should just go ahead the same way as without
> --with-remote.

But doesn't the on-demand initialization need to evaluate relative URLs and convert them to absolute based on the .gitmodules configuration? I thought the idea was to make `--with-remote` invalid for initialization/sync of absolute URLs.

In other words if I did:
git submodule init --with-remote fork my-submodule-dir

and if my-submodule-dir was not relative in .gitmodules, then the `--with-remote` flag becomes useless. We could fail silently but for educational purposes to the user I thought we were failing in these scenarios. Maybe I misunderstood your original intent with the failures? Is init not doing the relative to absolute evaluation like I'm thinking? Please correct me where I'm wrong.

Show 14 quoted lines
>> 4. The behavior of git submodule's `update` or `sync` commands
>> combined with `--with-remote` will REPLACE or CREATE the 'origin'
>> remote in each submodule it is run in. We will not allow the user to
>> configure what the submodule remote name will end up being (I think
>> this is current behavior and forces good practice; I consider `origin`
>> an adopted standard for git, and actually wish it was more enforced
>> for super projects as well!)
>
> No please carefully read my email again. I specifically was describing
> the opposite. --with-remote=<name> creates/replaces the remote <name> in
> the submodule. I do not see a benefit in restricting the user from
> creating different remote names in the submodule. I think it would be
> more confusing if the remote 'origin' in the superproject does not point
> to the same location as 'origin' in the submodule.

Well the reason why I said it would be 'origin' is so that the submodule knows which remote to use internally during an update. I'm assuming 'update' uses 'origin' internally in the submodule to know which remote to pull from. My understanding of how `git submodule update` knows which URL to pull from is probably incorrect. I'm not familiar on the internal mechanics of how this works. Perhaps you could explain or send me to some reading material on it?

Previous: Heiko VoigtNext: Heiko Voigt
Message 20 of 25 in “Relative submodule URLs”
  1. Robert DaileyAug 18, 2014
  2. Jonathan NiederAug 18, 2014
  3. Heiko VoigtAug 19, 2014
  4. Robert DaileyAug 19, 2014
  5. Junio C HamanoAug 19, 2014
  6. Robert DaileyAug 19, 2014
  7. Junio C HamanoAug 19, 2014
  8. Robert DaileyAug 19, 2014
  9. Heiko VoigtAug 19, 2014
  10. Robert DaileyAug 19, 2014
  11. Heiko VoigtAug 19, 2014
  12. Robert DaileyAug 20, 2014
  13. Heiko VoigtAug 21, 2014
  14. Robert DaileyAug 19, 2014
  15. Marc BranchaudAug 22, 2014
  16. Heiko VoigtAug 24, 2014
  17. Robert DaileyAug 25, 2014
  18. Robert DaileyAug 25, 2014
  19. Heiko VoigtAug 26, 2014
  20. Robert DaileyAug 26, 2014
  21. Heiko VoigtAug 26, 2014
  22. Robert DaileyAug 25, 2014
  23. Marc BranchaudAug 28, 2014
  24. Heiko VoigtAug 28, 2014
  25. Marc BranchaudAug 29, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.