public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
* Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs
@ 2024-06-05 14:02 Danoloan
  2024-06-05 17:32 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Danoloan @ 2024-06-05 14:02 UTC (permalink / raw)
  To: git

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-05 21:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 14:02 Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs Danoloan
2024-06-05 17:32 ` Junio C Hamano
2024-06-05 21:03   ` Danoloan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox