Git development
 help / color / mirror / Atom feed
From: "Matt Hunter" <m@lfurio.us>
To: "Benson Muite" <benson_muite@emailplus.org>,
	"Simon Richter" <Simon.Richter@hogyros.de>,
	"Junio C Hamano" <gitster@pobox.com>
Cc: <git@vger.kernel.org>
Subject: Re: Mirror repositories for submodules
Date: Fri, 05 Jun 2026 05:34:49 -0400	[thread overview]
Message-ID: <DJ10HH5HZF0E.3000F6WUQ1M08@lfurio.us> (raw)
In-Reply-To: <87pl25r3tz.fsf@emailplus.org>

On Fri Jun 5, 2026 at 12:47 AM EDT, Benson Muite wrote:
>
> For submodules, the metadata consists of the url of the repository to
> clone from.  One could have a list of absolute URLs.  The default would
> be to assume that the URLs are tried in order, and if a URL times out,
> the next one would be tried.  One may want to change the default
> ordering as a user setting, or do a ping test to get obtain content from
> the closest repository.

Another idea is for the client to attempt in a random order as a kind of
load balancing.

>
> As an example, for linphone-desktop, the first part of the .gitmodules
> file contains:
>
> [submodule "linphone-sdk"]
> path = external/linphone-sdk
> 	url = https://gitlab.linphone.org/BC/public/linphone-sdk.git
> [submodule "external/google/gn"]
>
> This could be updated to
>
> [submodule "linphone-sdk"]
> path = external/linphone-sdk
> 	url = https://gitlab.linphone.org/BC/public/linphone-sdk.git
>         url = https://github.com/BelledonneCommunications/linphone-sdk.git
> [submodule "external/google/gn"]

Relevant to Junio's earlier comment about aiming for a general solution:

It looks like the remote URL configuration already supports multiple
URLs per a single entry.  It's just that git only considers the first in
the list for fetching, and will push to all.

Your proposed change to .gitmodules may be used to initialize the list
of URLs for a cloned submodule's (single) initial remote?  At this
point, any kind of mirror management logic could generically operate on
each remote's URL list.

From git-config(1):
    remote.<name>.url
        The  URL of a remote repository. See git-fetch(1) or git-push(1).
        A configured remote can have multiple URLs; in this case the first
        is used for fetching, and all are used for pushing (assuming no
        remote.<name>.pushurl is defined).  Setting this key to the empty
        string clears the list of urls, allowing you to override earlier
        config.

From gitmodules(5):
    submodule.<name>.url
        Defines a URL from which the submodule repository can be cloned.
        This may be either an absolute URL ready to be passed to
        git-clone(1) or (if it begins with ./ or ../) a location relative
        to the superproject’s origin repository.

Note that the submodule format seems to explicitly support only a single
value right now.  Of course, I am assuming that the implementation
matches the documentation.

  reply	other threads:[~2026-06-05  9:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-01  6:11 Mirror repositories for submodules Benson Muite
2026-06-04  1:09 ` Junio C Hamano
2026-06-04  5:11   ` Simon Richter
2026-06-04  6:16     ` Jeff King
2026-06-04  9:27       ` Simon Richter
2026-06-05  4:54       ` Benson Muite
2026-06-05  4:47     ` Benson Muite
2026-06-05  9:34       ` Matt Hunter [this message]
2026-06-05  5:05     ` Benson Muite
2026-06-05  4:37   ` Benson Muite
2026-06-05  4:57   ` Benson Muite

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=DJ10HH5HZF0E.3000F6WUQ1M08@lfurio.us \
    --to=m@lfurio.us \
    --cc=Simon.Richter@hogyros.de \
    --cc=benson_muite@emailplus.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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