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

Re: issue with git submodules and a clone.defaultRemoteName different than origin?

From
Jacob Keller <jacob.e.keller@intel.com>
Date
Jun 6, 2025, 21:29 UTC
Message-ID
<bdf7e50f-aa65-4514-b147-9f7ebed147ab@intel.com>
In-Reply-To
<48c2af0f-348a-4443-a8b7-74ea4b666bff@intel.com>
On 6/4/2025 10:18 AM, Jacob Keller wrote:
Show 5 quoted lines
> 
> the parent project already has a URL in its config. What if we updated
> the logic to just directly use that URL instead of using a remote name?
> Or at the very least, we try to pick a remote based on the URL.
> 

I'm looking into this approach still, but I ran into some interesting issues with the remote.c logic which claims to work with any "struct repository *", but ends up calling paths to that hard code the_repository.

It looks like those end up in the "read_remotes_file" and "read_branches_file" functions which are deprecated, and planned to be removed in 3.0...

Would patches to modify those to take a repository pointer in order to allow callers of read_config() to work properly with a submodule repository be acceptable?

I also saw that many functions take a remote_state structure, but if I wanted to make them submodule repo compatible I would need to either add or switch to passing a repo pointer. I'm not sure what the best method for that is. Add parameters? We can get from repo to remote_state easily but we can't go back, so it seems like just switching them to take repo instead of remote_state would be sufficient.

I wanted to use the remote.c helpers rather than re-inventing the logic for reading the config to figure out remotes, both a) to find the correct remote by its URL and b) to find out if there is exactly 1 remote.

Previous: Jacob KellerNext: Junio C Hamano
Message 4 of 6 in “issue with git submodules and a clone.defaultRemoteName different than origin?”
  1. Jacob KellerJun 3, 2025
  2. Junio C HamanoJun 3, 2025
  3. Jacob KellerJun 4, 2025
  4. Jacob KellerJun 6, 2025
  5. Junio C HamanoJun 6, 2025
  6. Patrick SteinhardtJun 7, 2025

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.