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

Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs

From
DDanoloan <danolo@danoloan.es>
Date
Jun 5, 2024, 14:02 UTC
Message-ID
<7869f213fe59fa80b9e8331dde89e795bd8cd5d4.camel@danoloan.es>
Hello all,

I've noticed that changing the URL of a submodule may break the usefulness of git submodule update --recursive. For example, take a commit A1 in the repo A that has a submodule B with the commit B1. In commit A2, the URL of the submodule B is updated, and the commit is updated too to commit B2. B2 is present in the new URL of B but not in the old one. This is typical when the new URL may be a fork or a mirror in another server.

Given this scenario, the following steps will fail:
  - Clone A
  - Check out A1
  - Init submodules and recursively update
  - Check out A2
  - git submodule update --recursive --force will fail

This is because B2 is not present in the URL of B configured in the .gitmodules file of A2.

Do you think this use case should be fixed? I'm thinking that the "sync" operation should be implied in the git submodule update. It can be the default behaviour or a new option "--sync" could be added.

Thanks in advance for your attention & BR
Next: Junio C Hamano
Message 1 of 3 in “Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs”
  1. DanoloanJun 5, 2024
  2. Junio C HamanoJun 5, 2024
  3. DanoloanJun 5, 2024

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.