From: Junio C Hamano <gitster@pobox.com>
To: Javier Mora <cousteaulecommandant@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Potential problems with url.<base>.insteadOf
Date: Fri, 26 Aug 2022 09:13:27 -0700 [thread overview]
Message-ID: <xmqq7d2v0yqg.fsf@gitster.g> (raw)
In-Reply-To: <CAH1-q0iPsnkypiF=2LRgXwNqE_+R0gj706FCKgqGEUum+OAhQg@mail.gmail.com> (Javier Mora's message of "Fri, 26 Aug 2022 01:47:08 +0200")
Javier Mora <cousteaulecommandant@gmail.com> writes:
> 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?
next prev parent reply other threads:[~2022-08-26 16:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-25 23:47 Potential problems with url.<base>.insteadOf Javier Mora
2022-08-26 7:09 ` Andreas Schwab
2022-08-26 9:34 ` Javier Mora
2022-08-26 16:13 ` Junio C Hamano [this message]
2022-08-26 16:16 ` Junio C Hamano
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=xmqq7d2v0yqg.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=cousteaulecommandant@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).