public inbox for git@vger.kernel.org
 help / color / mirror / Atom feed
From: Danoloan <danolo@danoloan.es>
To: git@vger.kernel.org
Subject: Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs
Date: Wed, 05 Jun 2024 16:02:10 +0200	[thread overview]
Message-ID: <7869f213fe59fa80b9e8331dde89e795bd8cd5d4.camel@danoloan.es> (raw)

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



             reply	other threads:[~2024-06-05 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05 14:02 Danoloan [this message]
2024-06-05 17:32 ` Git submodule recursive update not syncing submodule URLs makes the operation fail for commits updating the URLs Junio C Hamano
2024-06-05 21:03   ` Danoloan

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7869f213fe59fa80b9e8331dde89e795bd8cd5d4.camel@danoloan.es \
    --to=danolo@danoloan.es \
    --cc=git@vger.kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox