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

Re: url.<base>.insteadOf vs. submodules

From
Jeff King <peff@peff.net>
Date
Feb 20, 2017, 20:52 UTC
Message-ID
<20170220205243.lynnmxouwq7jelld@sigill.intra.peff.net>
In-Reply-To
<404d109f-e5a7-85a3-e64c-ab1b21c3045d@durchholz.org>
On Mon, Feb 20, 2017 at 09:31:40PM +0100, Toolforger wrote:
Show 12 quoted lines
> > The submodule operations happen in their own processes, and do not look
> > at the config of the parent repo.
> 
> Ah, then we have a docbug.
> git help config has this to say:
> 
> url.<base>.insteadOf
>     Any URL that starts with this value will be rewritten to start,
>     instead, with <base>.
> 
> The "Any" here is wrong, it would be "any except submodule" (possibly other
> exceptions).

I'm not sure that "any" is wrong here. Repository-specific config does not cross repository boundaries. That applies to this config value, and to all the others, too (e.g., if you set "diff.renames" in the super-project, it would not have an effect in the submodule).

I think if there is a doc bug, it is that the repo boundary between the submodule and the super-project is not made more clear.

That said, I do think it would be a useful feature for the super-project to rewrite URLs before handing them off to the submodule. But I do not really work on submodules nor use them myself, so there may be complications.

I suppose you could argue that failing to rewrite violates the "any" in the quoted text. It doesn't say when the rewriting occurs, but it is essentially "when the URL is accessed". So the super-project feeds the raw URL to the submodule `git clone`, which then applies any URL rewriting.

> > but one workaround is to set the config in ~/.gitconfig.
> 
> No can do - that's under version control.
> My personal setup does not belong there I think ;-)

I'm not sure I understand. You have a project policy to use certain URLs. But you, the user, want to override that. Why isn't the user-specific config file the right place to put that?

(I think there _is_ a mismatch, in that the change is specific not just to your user, but to the repo. So you would not want to rewrite other references to the same URL in other repos. But that does not seem to be your objection).

-Peff
Previous: ToolforgerNext: Toolforger
Message 4 of 19 in “url.<base>.insteadOf vs. submodules”
  1. ToolforgerFeb 19, 2017
  2. Jeff KingFeb 20, 2017
  3. ToolforgerFeb 20, 2017
  4. Jeff KingFeb 20, 2017
  5. ToolforgerFeb 21, 2017
  6. Jeff KingFeb 21, 2017
  7. Stefan BellerFeb 21, 2017
  8. Jeff KingFeb 21, 2017
  9. Stefan BellerFeb 21, 2017
  10. Junio C HamanoFeb 21, 2017
  11. Junio C HamanoFeb 21, 2017
  12. Stefan BellerFeb 22, 2017
  13. Junio C HamanoFeb 22, 2017
  14. Jon LoeligerFeb 22, 2017
  15. Junio C HamanoFeb 22, 2017
  16. Jeff KingFeb 22, 2017
  17. Stefan BellerFeb 22, 2017
  18. Jeff KingFeb 21, 2017
  19. Stefan BellerFeb 22, 2017

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.