Web lists-archives.com

Re: possible submodule bug?




On 2019-05-30 at 18:16:17, Alex Levy wrote:
> I've found a workaround if I manually edit .git/config in each clone to reflect the correct URL.  After doing that, running "git submodule update --init" works as expected.
> 
> My understanding is that I shouldn't ever have to edit anything in the .git directory.  So, have I found a bug with .gitmodules being ignored after adding a given submodule?  Or is this just user error, a case of "Don't do that.  Initialize the submodule with the correct URL and move on."?

git-submodule(1) documents this behavior under the init subcommand:

  When present, it will also copy the value of `submodule.$name.update`.
  This command does not alter existing information in .git/config. You
  can then customize the submodule clone URLs in .git/config for your
  local setup and proceed to `git submodule update`; you can also just
  use `git submodule update --init` without the explicit 'init' step if
  you do not intend to customize any submodule locations.

The goal is to let you customize the URL. For example, maybe you are
using an open-source project with submodules but you're on a restricted
corporate network where access to certain sites is prohibited, or maybe
the server hosting the submodule is down temporarily or permanently.

So this isn't really a bug, but more of a feature, even if it's
inconvenient in this particular case.

You can, however, use "git submodule sync" to sync across updated
changes to the URL. This is a bunch easier and faster than editing
things by hand or with "git config".
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

Attachment: signature.asc
Description: PGP signature