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

Re: Potential problems with url.<base>.insteadOf

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 26, 2022, 16:13 UTC
Message-ID
<xmqq7d2v0yqg.fsf@gitster.g>
In-Reply-To
<CAH1-q0iPsnkypiF=2LRgXwNqE_+R0gj706FCKgqGEUum+OAhQg@mail.gmail.com>
Javier Mora <cousteaulecommandant@gmail.com> writes:
Show 16 quoted lines
> The choice of `url.<replacement>.insteadOf <original>` as a way to
> replace URLs is not only a bit confusing, as it has already been
> discussed[1], but also presents some problems and makes it impossible
> to achieve certain configurations.
> [1] https://public-inbox.org/git/20181122173109.GI28192@sigill.intra.peff.net/
>
> SCENARIO 1:
> I want to replace all references to the (now defunct)
> 'http://example.org/' to the new server, 'http://example.com/'.
>
> OK, that is easy (even if a bit counter-intuitive).  Just do:
> git config url.'http://example.com/'.insteadOf 'http://example.org/'
>
> SCENARIO 2:
> I want to replace BOTH 'http://example.org/' and 'http://example.net/'
> with 'http://example.com/'.
So, you want to end up with
    [url "http://example.com/"]
	insteadOf = http://example.org
	insteadOf = http://example.net

but you cannot get there with only "git config VARIABLE VALUE", because that syntax is used to clear the existing values for VARIRABLE before setting it to VALUE.

Have you tried
    $ git config url.http://example.com/.insteadof http://example.org

that clears existing values for url.http://example.com/.insteadof and sets it to "http://example.org", then immediately follow it with

    $ git config --add url.http://example.com/.insteadof http://example.net

that keeps existing values for url.http://example.com/.insteadof and adds another value to the same variable?

Previous: Javier MoraNext: Junio C Hamano
Message 4 of 5 in “Potential problems with url.<base>.insteadOf”
  1. Javier MoraAug 25, 2022
  2. Andreas SchwabAug 26, 2022
  3. Javier MoraAug 26, 2022
  4. Junio C HamanoAug 26, 2022
  5. Junio C HamanoAug 26, 2022

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.