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

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

From
Javier Mora <cousteaulecommandant@gmail.com>
Date
Aug 26, 2022, 09:34 UTC
Message-ID
<CAH1-q0j8a4q47UOBvUp0W0JgF+W7J+EQLLRhv9hx-dxdhqSYqA@mail.gmail.com>
In-Reply-To
<87a67rjxb6.fsf@linux-m68k.org>

El vie, 26 ago 2022 a las 9:09, Andreas Schwab (<schwab@linux-m68k.org>) escribió:

Show 9 quoted lines
>
> On Aug 26 2022, Javier Mora wrote:
>
> > Well, now I have a problem.  If I do:
> >
> > git config url.'http://example.com/'.insteadOf 'http://example.org/'
> > git config url.'http://example.com/'.insteadOf 'http://example.net/'
>
> git config --add url.'http://example.com/'.insteadOf 'http://example.net/'

Well, that was embarrassing... My bad; I didn't know about the `--add` option (nor that gitconfig supported multi-value options, for that matter, but that's on me for not reading the whole manpage). Maybe the manpage section on `insteadOf` should mention that it's a multi-value option, but I see that this is not a bug as I thought it was. (If anything, a not-very-intuitive feature, but that's a different matter.)

One minor issue I still see is the fact that adding the same insteadOf key-value pair multiple times will result in the same line being added multiple times unless you explicitly delete it first; there doesn't seem to be an easy way to "add key-value pair if it doesn't exist yet". (The closest seems to be `--replace-all`, but that complicates things a bit.)

Previous: Andreas SchwabNext: Junio C Hamano
Message 3 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.